data(nodal) binaryfit = glm(cbind(r,m-r) ~ ., data = nodal, family = binomial) summary(binaryfit) # Call: # glm(formula = cbind(r, m - r) ~ ., family = binomial, data = nodal) # Deviance Residuals: # Min 1Q Median 3Q Max # -2.3317 -0.6653 -0.2999 0.6386 2.1502 # Coefficients: # Estimate Std. Error z value Pr(>|z|) # (Intercept) -3.0794 0.9868 -3.121 0.0018 ** # aged1 -0.2917 0.7540 -0.387 0.6988 # stage1 1.3729 0.7838 1.752 0.0799 . # grade1 0.8720 0.8156 1.069 0.2850 # xray1 1.8008 0.8104 2.222 0.0263 * # acid1 1.6839 0.7915 2.128 0.0334 * # --- # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # (Dispersion parameter for binomial family taken to be 1) # Null deviance: 70.252 on 52 degrees of freedom # Residual deviance: 47.611 on 47 degrees of freedom # AIC: 59.611 # Number of Fisher Scoring iterations: 5 step(binaryfit) # Start: AIC=59.61 # cbind(r, m - r) ~ aged + stage + grade + xray + acid # Df Deviance AIC # - aged 1 47.760 57.760 # - grade 1 48.760 58.760 # 47.611 59.611 # - stage 1 50.808 60.808 # - acid 1 52.660 62.660 # - xray 1 52.922 62.922 # Step: AIC=57.76 # cbind(r, m - r) ~ stage + grade + xray + acid # Df Deviance AIC # - grade 1 49.180 57.180 # 47.760 57.760 # - stage 1 50.817 58.817 # - xray 1 53.162 61.162 # - acid 1 53.526 61.526 # Step: AIC=57.18 # cbind(r, m - r) ~ stage + xray + acid # Df Deviance AIC # 49.180 57.180 # - acid 1 54.463 60.463 # - stage 1 54.788 60.788 # - xray 1 55.915 61.915 # Call: glm(formula = cbind(r, m - r) ~ stage + xray + acid, family = binomial, # data = nodal) # Coefficients: # (Intercept) stage1 xray1 acid1 # -3.052 1.645 1.912 1.638 # Degrees of Freedom: 52 Total (i.e. Null); 49 Residual # Null Deviance: 70.25 # Residual Deviance: 49.18 AIC: 57.18 > nodal2 m r age stage grade xray acid 1 6 5 0 1 1 1 1 2 6 1 0 0 0 0 1 3 4 0 1 1 1 0 0 4 4 2 1 1 0 0 1 5 4 0 0 0 0 0 0 6 3 2 0 1 1 0 1 7 3 1 1 1 0 0 0 8 3 0 1 0 0 0 1 9 3 0 1 0 0 0 0 10 2 0 1 0 0 1 0 11 2 1 0 1 0 0 1 12 2 1 0 0 1 0 0 13 1 1 1 1 1 1 1 14 1 1 1 1 0 1 1 15 1 1 1 0 1 1 1 16 1 1 1 0 0 1 1 17 1 0 1 0 1 0 0 18 1 1 0 1 1 1 0 19 1 0 0 1 1 0 0 20 1 1 0 1 0 1 0 21 1 1 0 0 1 0 1 22 1 0 0 0 0 1 1 23 1 0 0 0 0 1 0 > binomialfit = glm(cbind(r,m-r) ~ ., family =binomial, data=nodal2) > summary(binomialfit) # Call: # glm(formula = cbind(r, m - r) ~ ., family = binomial, data = nodal2) # Deviance Residuals: # Min 1Q Median 3Q Max # -1.4989 -0.7726 -0.1265 0.7997 1.4351 # Coefficients: # Estimate Std. Error z value Pr(>|z|) # (Intercept) -3.0794 0.9868 -3.121 0.0018 ** # age -0.2917 0.7540 -0.387 0.6988 # stage 1.3729 0.7838 1.752 0.0799 . # grade 0.8720 0.8156 1.069 0.2850 # xray 1.8008 0.8104 2.222 0.0263 * # acid 1.6839 0.7915 2.128 0.0334 * # --- # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # (Dispersion parameter for binomial family taken to be 1) # Null deviance: 40.710 on 22 degrees of freedom # Residual deviance: 18.069 on 17 degrees of freedom # AIC: 41.693 # Number of Fisher Scoring iterations: 5 > step(binomialfit) #... # Call: glm(formula = cbind(r, m - r) ~ stage + xray + acid, family = binomial, # data = nodal2) # Coefficients: # (Intercept) stage xray acid # -3.052 1.645 1.912 1.638 # Degrees of Freedom: 22 Total (i.e. Null); 19 Residual # Null Deviance: 40.71 # Residual Deviance: 19.64 AIC: 39.26