logit regression

参考文章:https://www.r-bloggers

> CarData = read.table('car.data',sep=',',col.names=c('buying','maintenance','doors','persons','lug_boot','safety','rating'))
> summary(CarData)
   buying    maintenance   doors     persons     lug_boot    safety      rating    
 high :432   high :432   2    :432   2   :576   big  :576   high:576   acc  : 384  
 low  :432   low  :432   3    :432   4   :576   med  :576   low :576   good :  69  
 med  :432   med  :432   4    :432   more:576   small:576   med :576   unacc:1210  
 vhigh:432   vhigh:432   5more:432                                     vgood:  65  
> logisticModel <- glm(rating!='unacc' ~ buying + maintenance + doors + persons + lug_boot +safety,
+                      family=binomial(link = "logit"),data=CarData)               

> summary(logisticModel)

Call:
glm(formula = rating != "unacc" ~ buying + maintenance + doors + 
    persons + lug_boot + safety, family = binomial(link = "logit"), 
    data = CarData)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.2160   0.0000   0.0000   0.0257   2.4336  

Coefficients:
                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)       -28.4255  1257.5255  -0.023    0.982    
buyinglow           5.0481     0.5670   8.904  < 2e-16 ***
buyingmed           3.9218     0.4842   8.100 5.49e-16 ***
buyingvhigh        -2.0662     0.3747  -5.515 3.49e-08 ***
maintenancelow      3.4064     0.4692   7.261 3.86e-13 ***
maintenancemed      3.4064     0.4692   7.261 3.86e-13 ***
maintenancevhigh   -2.8254     0.4145  -6.816 9.36e-12 ***
doors3              1.8556     0.4042   4.591 4.41e-06 ***
doors4              2.4816     0.4278   5.800 6.62e-09 ***
doors5more          2.4816     0.4278   5.800 6.62e-09 ***
persons4           29.9652  1257.5256   0.024    0.981    
personsmore        29.5843  1257.5255   0.024    0.981    
lug_bootmed        -1.5172     0.3758  -4.037 5.40e-05 ***
lug_bootsmall      -4.4476     0.4750  -9.363  < 2e-16 ***
safetylow         -30.5045  1300.3428  -0.023    0.981    
safetymed          -3.0044     0.3577  -8.400  < 2e-16 ***
---
Signif. codes:  0 ��***�� 0.001 ��**�� 0.01 ��*�� 0.05 ��.�� 0.1 �� �� 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 2110.47  on 1727  degrees of freedom
Residual deviance:  339.36  on 1712  degrees of freedom
AIC: 371.36

Number of Fisher Scoring iterations: 21

.com/learn-logistic-regression-and-beyond/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值