R version 2.9.2 (2009-08-24) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(boot) > data(nodal) > nodal[1:3,] m r aged stage grade xray acid 1 1 1 0 1 1 1 1 2 1 1 0 1 1 1 1 3 1 1 0 1 1 1 1 > ex1018.glm = glm(r ~ ., data = nodal, family=binomial)## binary regression > summary(ex1018.glm) Call: glm(formula = r ~ ., family = binomial, data = nodal) Deviance Residuals: Min 1Q Median 3Q Max -2.3317 -0.6653 -0.2999 0.6386 2.1502 Coefficients: (1 not defined because of singularities) Estimate Std. Error z value Pr(>|z|) (Intercept) -3.0794 0.9868 -3.121 0.00180 ** m NA NA NA NA aged -0.2917 0.7540 -0.387 0.69881 stage 1.3729 0.7838 1.752 0.07986 . grade 0.8720 0.8156 1.069 0.28500 xray 1.8008 0.8104 2.222 0.02628 * acid 1.6839 0.7915 2.128 0.03337 * --- 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 > update(ex1018.glm, . ~ . - aged - grade) Call: glm(formula = r ~ m + stage + xray + acid, family = binomial, data = nodal) Coefficients: (Intercept) m stage xray -3.052 NA 1.645 1.912 acid 1.638 Degrees of Freedom: 52 Total (i.e. Null); 49 Residual Null Deviance: 70.25 Residual Deviance: 49.18 AIC: 57.18 #### binomial regression ######################### > m = scan() 1: 6 6 4 4 4 3 3 3 3 2 2 2 1 1 1 1 1 1 1 1 1 1 1 24: Read 23 items > r = scan() 1: 5 1 0 2 0 2 1 0 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 24: Read 23 items > age = scan() 1: 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 24: Read 23 items > stage = scan() 1: 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 0 24: Read 23 items > grade = scan() 1: 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 24: Read 23 items > xray = scan() 1: 1 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 1 0 1 0 1 1 24: Read 23 items > acid = scan() 1: 1 1 0 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 0 0 1 1 0 24: Read 23 items > glm2 = glm(cbind(r,m-r) ~ age+stage+grade+xray+acid,family=binomial) > summary(glm2) Call: glm(formula = cbind(r, m - r) ~ age + stage + grade + xray + acid, family = binomial) 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.00180 ** age -0.2917 0.7540 -0.387 0.69881 stage 1.3729 0.7838 1.752 0.07986 . grade 0.8720 0.8156 1.069 0.28500 xray 1.8008 0.8104 2.222 0.02628 * acid 1.6839 0.7915 2.128 0.03337 * --- 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 > summary(glm(cbind(r,m-r)~stage+xray+acid,family=binomial) + ) Call: glm(formula = cbind(r, m - r) ~ stage + xray + acid, family = binomial) Deviance Residuals: Min 1Q Median 3Q Max -1.3947 -0.6350 -0.1823 0.7637 1.8750 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -3.0518 0.8420 -3.624 0.00029 *** stage 1.6453 0.7297 2.255 0.02414 * xray 1.9116 0.7771 2.460 0.01390 * acid 1.6378 0.7539 2.172 0.02983 * --- 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: 19.638 on 19 degrees of freedom AIC: 39.263 Number of Fisher Scoring iterations: 5