Demonstration

Source 1: Exercise

Source 2: Solutions

Source : EpiData

Loading the data:

Name: Tubercolosis Incidence among Employees

Source: Department of Radiology and Imaging Sciences, Southern Philippines Medical Center

Printing the output of the model

## 
## Call:
## glm(formula = Outcome ~ factor(Sex) + factor(Age) + factor(Years) + 
##     factor(Job), family = binomial, data = data)
## 
## Deviance Residuals: 
##      Min        1Q    Median        3Q       Max  
## -1.26105  -0.42987  -0.31197  -0.04964   2.50379  
## 
## Coefficients:
##                  Estimate Std. Error z value Pr(>|z|)
## (Intercept)      -19.5503  3979.8030  -0.005    0.996
## factor(Sex)1       0.3297     0.6204   0.531    0.595
## factor(Age)2       0.8279     0.7058   1.173    0.241
## factor(Age)3       0.4943     0.9361   0.528    0.597
## factor(Age)4       1.0958     1.0961   1.000    0.317
## factor(Age)5     -17.3063  7114.1013  -0.002    0.998
## factor(Years)2    17.3256  3979.8030   0.004    0.997
## factor(Years)3    16.4953  3979.8030   0.004    0.997
## factor(Years)4    16.5923 11738.9887   0.001    0.999
## factor(Job)1      -0.8653     1.2280  -0.705    0.481
## factor(Job)2     -18.1693  7604.2355  -0.002    0.998
## factor(Job)3     -18.0335  2513.2108  -0.007    0.994
## factor(Job)4      -1.4192     1.2624  -1.124    0.261
## factor(Job)5       1.4988     1.4413   1.040    0.298
## factor(Job)6      -0.4377     0.8333  -0.525    0.599
## factor(Job)7      -0.2292     1.0323  -0.222    0.824
## factor(Job)8     -17.6710  7604.2356  -0.002    0.998
## factor(Job)9       1.3234     1.0045   1.317    0.188
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 115.243  on 193  degrees of freedom
## Residual deviance:  94.933  on 176  degrees of freedom
## AIC: 130.93
## 
## Number of Fisher Scoring iterations: 18

Generating Odds ratio statistic

##                          OR  2.5 %        97.5 %
## (Intercept)    0.000000e+00     NA 1.388463e+118
## factor(Sex)1   1.390500e+00 0.4020  4.743400e+00
## factor(Age)2   2.288500e+00 0.5914  1.011350e+01
## factor(Age)3   1.639400e+00 0.2358  1.031670e+01
## factor(Age)4   2.991600e+00 0.3080  2.505000e+01
## factor(Age)5   0.000000e+00 0.0000 2.986140e+113
## factor(Years)2 3.345056e+07 0.0000           Inf
## factor(Years)3 1.458136e+07 0.0000            NA
## factor(Years)4 1.606700e+07 0.0000           Inf
## factor(Job)1   4.209000e-01 0.0192  3.897900e+00
## factor(Job)2   0.000000e+00     NA           Inf
## factor(Job)3   0.000000e+00     NA  1.329156e+62
## factor(Job)4   2.419000e-01 0.0106  2.414600e+00
## factor(Job)5   4.476200e+00 0.1623  7.319650e+01
## factor(Job)6   6.455000e-01 0.1299  3.764300e+00
## factor(Job)7   7.952000e-01 0.0863  5.944700e+00
## factor(Job)8   0.000000e+00     NA           Inf
## factor(Job)9   3.756300e+00 0.5209  2.956570e+01