楼主: 迷途mitu
11926 5

[问答] 请问glm估计出来的模型怎么看伪R平方? [推广有奖]

  • 5关注
  • 11粉丝

教授

23%

还不是VIP/贵宾

-

威望
0
论坛币
2399 个
通用积分
21.1086
学术水平
11 点
热心指数
35 点
信用等级
12 点
经验
176 点
帖子
583
精华
0
在线时间
851 小时
注册时间
2010-4-17
最后登录
2022-12-7

100论坛币
请问glm估计出来的模型怎么看伪R平方?用summary只有参数的显著性,但是没有R平方的结果。
  1. Call:
  2. glm(formula = GR ~ C + F1 + I, family = binomial(link = "probit"),
  3. data = data)

  4. Deviance Residuals:
  5. Min 1Q Median 3Q Max
  6. -1.2771 -0.4532 -0.3646 -0.2682 2.3106

  7. Coefficients:
  8. Estimate Std. Error z value Pr(>|z|)
  9. (Intercept) 2.37052 3.62695 0.654 0.51338
  10. C -0.03203 0.04870 -0.658 0.51080
  11. F1 -1.40809 0.54465 -2.585 0.00973 **
  12. I 6.87745 605.10217 0.011 0.99093
  13. ---
  14. Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

  15. (Dispersion parameter for binomial family taken to be 1)

  16. Null deviance: 40.472 on 40 degrees of freedom
  17. Residual deviance: 28.160 on 37 degrees of freedom
  18. AIC: 36.16

  19. Number of Fisher Scoring iterations: 15
复制代码

最佳答案

qiangli 查看完整内容

这是Applied Econometrics with R 书上的例子
关键词:R平方 coefficients coefficient iterations dispersion family Error 模型
沙发
qiangli 发表于 2014-4-18 18:52:34 |只看作者 |坛友微信交流群
  1. 需要自己计算
复制代码
  1. install.package("AER")

  2. library("AER")
  3. data("SwissLabor")

  4. swiss_probit <- glm(participation ~ . + I(age^2),
  5.                     data = SwissLabor, family = binomial(link = "probit"))
  6. summary(swiss_probit)

  7. swiss_probit0 <- glm(participation ~ 1 ,
  8.                     data = SwissLabor, family = binomial(link = "probit"))
  9. summary(swiss_probit0)

  10. #Goodness of fit and prediction
  11. pseudo_R2<-  1 - as.vector(logLik(swiss_probit)/logLik(swiss_probit0))
  12. pseudo_R2
复制代码

这是Applied Econometrics with R 书上的例子

使用道具

藤椅
Aharach 发表于 2014-4-18 22:09:49 |只看作者 |坛友微信交流群
http://stats.stackexchange.com/questions/8511/how-to-calculate-pseudo-r2-from-rs-logistic-regression

答案里面提供了2种方法, 比较直接的是用 rms 软件包
  1. require(rms)
  2. mod1b <- lrm(y ~ x)
  3. printed(mod1b)
复制代码

使用道具

板凳
迷途mitu 发表于 2014-4-18 22:30:39 |只看作者 |坛友微信交流群
Aharach 发表于 2014-4-18 22:09
http://stats.stackexchange.com/questions/8511/how-to-calculate-pseudo-r2-from-rs-logistic-regression ...
那个网址怎么打不开?
下面那个代码怎么用呢?比如我已经用glm估计除了probit,怎么显示他的R平方呢?

使用道具

报纸
迷途mitu 发表于 2014-4-18 22:40:53 |只看作者 |坛友微信交流群
qiangli 发表于 2014-4-18 20:39
这是Applied Econometrics with R 书上的例子
哦 非常感谢!

使用道具

地板
kawen111 发表于 2020-8-11 21:22:07 |只看作者 |坛友微信交流群
马克一下~

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-26 21:12