资源描述:
《一个逻辑回归的简单例子.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、x1<-rep(c(1,0,1,0,1),c(5,10,10,10,10))>x2<-c(17,44,48,55,75,35,42,57,28,20,38,45,47,52,55,68,18,68,48,17,+70,72,35,19,62,39,40,55,68,25,17,45,44,67,55,61,19,69,23,19,+72,74,31,16,61)>x3<-c(1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,1,0,0,1,0,0,0,0,0,
2、1,1,0,1,0,1,1,0,1,1)>y<-c(1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,1,0,0,0,1,0,1,0,1,0,0)>accident<-data.frame(x1,x2,x3,y)>log.glm<-glm(y~x1+x2+x3,family=binomial,data=accident)>summary(log.glm)Call:glm(formula=y~x1+x2+x3,family=bin
3、omial,data=accident)DevianceResiduals:Min1QMedian3QMax-1.5636-0.9131-0.78920.96371.6000Coefficients:EstimateStd.ErrorzvaluePr(>
4、z
5、)(Intercept)0.0.0.6680.5042x1-1.0.-2.1230.0338*x2-0.0.-0.0950.9242x30.0.0.4510.6523---Signif.codes:0‘***’0.001‘**’0.01‘*’0.05‘.’0
6、.1‘’1(Dispersionparameterforbinomialfamilytakentobe1)Nulldeviance:62.183on44degreesoffreedomResidualdeviance:57.026on41degreesoffreedomAIC:65.026NumberofFisherScoringiterations:4