hwk4-5.2.R - Output from hwk4‐5.2.R: > oring...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Output from hwk4‐5.2.R: > oring <‐ read.table(file="C:\\Documents and Settings\\dhall\\My Documents\\Dans Work Stuff\\courses\\STAT8620\\Fall 09\\oring.dat",header=T) > #oring <‐ read.table(file="N:\\courses\\STAT8620\\Fall 09\\oring.dat",header=T) > oring[1:3,] temp td 1 66 0 2 70 1 3 69 0 > > m1 <‐ glm(td~temp,data=oring,family=binomial(link="logit")) > summary(m1) Call: glm(formula = td ~ temp, family = binomial(link = "logit"), data = oring) Deviance Residuals: Min 1Q Median 3Q Max ‐1.0611 ‐0.7613 ‐0.3783 0.4524 2.2175 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 15.0429 7.3786 2.039 0.0415 * temp ‐0.2322 0.1082 ‐2.145 0.0320 * ‐‐‐ Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 28.267 on 22 degrees of freedom Residual deviance: 20.315 on 21 degrees of freedom AIC: 24.315 Number of Fisher Scoring iterations: 5 > > t0 <‐ seq(from=min(oring$temp),to=max(oring$temp),length=100) > expit <‐ function(x) {1/(1+exp(‐x)) } > > plot(oring$temp,oring$td,type="p",xlab="Temperature",ylab="Thermal Distress", + main="Fitted probability from model m1") > lines(t0,expit( coef(m1)[1]+coef(m1)[2]*t0),lty=2) > > p31 <‐ expit( coef(m1)[1]+coef(m1)[2]*31) > pred.m1 <‐ predict(m1,data.frame(temp=c(31)),se.fit=T,type="link") > L <‐ expit(pred.m1$fit‐1.96*pred.m1$se.fit) > U <‐ expit(pred.m1$fit+1.96*pred.m1$se.fit) > cbind(L,p31,U) L p31 U 1 0.4815743 0.9996088 0.9999999 > > oring$tmp <‐ (oring$temp‐mean(oring$temp))/sd(oring$temp) > m2 <‐ glm(td~tmp+I(tmp^2),data=oring,family=binomial(link="logit")) > anova(m1,m2,test="Chisq") Analysis of Deviance Table Model 1: td ~ temp Model 2: td ~ tmp + I(tmp^2) Resid. Df Resid. Dev Df Deviance P(>|Chi|) 1 21 20.3152 2 20 19.3887 1 0.9265 0.3358 > > m3 <‐ glm(td~factor(temp),data=oring,family=binomial(link="logit")) > anova(m1,m3,test="Chisq") Analysis of Deviance Table Model 1: td ~ temp Model 2: td ~ factor(temp) Resid. Df Resid. Dev Df Deviance P(>|Chi|) 1 21 20.3152 2 7 8.3178 14 11.9974 0.6065 > > summary(m3) Call: glm(formula = td ~ factor(temp), family = binomial(link = "logit"), data = oring) Deviance Residuals: Min 1Q Median 3Q Max ‐1.177e+00 ‐4.838e‐05 ‐4.838e‐05 4.838e‐05 1.177e+00 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 2.057e+01 1.773e+04 0.001 0.999 factor(temp)57 ‐1.924e‐08 2.507e+04 ‐7.67e‐13 1.000 factor(temp)58 ‐1.931e‐08 2.507e+04 ‐7.70e‐13 1.000 factor(temp)63 ‐1.936e‐08 2.507e+04 ‐7.72e‐13 1.000 factor(temp)66 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)67 ‐4.113e+01 2.047e+04 ‐0.002 0.998 factor(temp)68 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)69 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)70 ‐2.057e+01 1.773e+04 ‐0.001 0.999 factor(temp)72 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)73 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)75 ‐2.057e+01 1.773e+04 ‐0.001 0.999 factor(temp)76 ‐4.113e+01 2.172e+04 ‐0.002 0.998 factor(temp)78 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)79 ‐4.113e+01 2.507e+04 ‐0.002 0.999 factor(temp)81 ‐4.113e+01 2.507e+04 ‐0.002 0.999 (Dispersion parameter for binomial family taken to be 1) Null deviance: 28.2672 on 22 degrees of freedom Residual deviance: 8.3178 on 7 degrees of freedom AIC: 40.318 Number of Fisher Scoring iterations: 19 > summary(influence.measures(m1)) Potentially influential observations of glm(formula = td ~ temp, family = binomial(link = "logit"), data = oring) : dfb.1_ dfb.temp dffit cov.r cook.d hat 9 0.30 ‐0.29 0.32 1.34_* 0.03 0.21 14 0.17 ‐0.16 0.17 1.30_* 0.01 0.17 21 ‐0.55 0.58 0.72 0.65_* 0.43 0.07 23 0.33 ‐0.32 0.36 1.33_* 0.03 0.21 > ...
View Full Document

Ask a homework question - tutors are online