【问题标题】:How do you find R-squared and Beta values from a Betareg model in R?如何从 R 中的 Betareg 模型中找到 R 平方和 Beta 值?
【发布时间】:2017-08-06 15:01:43
【问题描述】:

我有一个 beta 回归模型(使用包 'betareg')和绘图,但为了报告结果,我需要 R-squared 和 Beta。我只知道lm.beta funtion 用于从lm 方程中找到Beta,而summary(lm(DV~IV, data=mydata))$r.squared 用于从lm 方程中找到r 平方。如何找到 beta 回归模型的这些值?

【问题讨论】:

  • 定义 Rsquared。提示:除了线性回归之外,它并不是那么简单。

标签: r regression


【解决方案1】:

betareg 类的对象有多种提取函数,请参阅vignette("betareg", package = "betareg") 中的表 1。

作为一个简单的例子,考虑ReadingSkills 案例研究(第 5.1 节):

library("betareg")
data("ReadingSkills", package = "betareg")
m <- betareg(accuracy ~ iq * dyslexia | iq + dyslexia, data = ReadingSkills)

通常的摘要包含您要查找的信息:

summary(m)
## Call:
## betareg(formula = accuracy ~ iq * dyslexia | iq + dyslexia, data = ReadingSkills)
## 
## Standardized weighted residuals 2:
##     Min      1Q  Median      3Q     Max 
## -2.3900 -0.6416  0.1572  0.8524  1.6446 
## 
## Coefficients (mean model with logit link):
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   1.1232     0.1428   7.864 3.73e-15 ***
## iq            0.4864     0.1331   3.653 0.000259 ***
## dyslexia     -0.7416     0.1428  -5.195 2.04e-07 ***
## iq:dyslexia  -0.5813     0.1327  -4.381 1.18e-05 ***
## 
## Phi coefficients (precision model with log link):
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   3.3044     0.2227  14.835  < 2e-16 ***
## iq            1.2291     0.2672   4.600 4.23e-06 ***
## dyslexia      1.7466     0.2623   6.658 2.77e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Type of estimator: ML (maximum likelihood)
## Log-likelihood:  65.9 on 7 Df
## Pseudo R-squared: 0.5756
## Number of iterations: 25 (BFGS) + 1 (Fisher scoring) 

要提取特定部分,例如伪 R 平方,您可以访问 summary() 的元素:

summary(m)$pseudo.r.squared
## 0.5756258

或者有专门的方法:

coef(m)
##       (Intercept)                iq          dyslexia       iq:dyslexia 
##         1.1232250         0.4863696        -0.7416450        -0.5812569 
## (phi)_(Intercept)          (phi)_iq    (phi)_dyslexia 
##         3.3044312         1.2290731         1.7465642 
coef(m, model = "mean")
## (Intercept)          iq    dyslexia iq:dyslexia 
##   1.1232250   0.4863696  -0.7416450  -0.5812569 
coef(m, model = "precision")
## (Intercept)          iq    dyslexia 
##    3.304431    1.229073    1.746564 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-06
    • 2014-06-24
    • 2018-10-02
    • 2020-04-30
    • 1970-01-01
    • 2013-04-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多