Fractional Response Regression in R

巧了我就是萌 提交于 2019-12-04 12:52:45
coffeinjunky

The differences in the two approaches stem from different degree of freedom corrections in the computation of the robust standard errors. Using similar defaults, the results will be identical. See the following example:

library(foreign)
library(frm)
library(sandwich)
library(lmtest)

df <- read.dta("http://fmwww.bc.edu/ec-p/data/wooldridge/401k.dta")
df$prate <- df$prate/100

y <- df$prate
x <- df[,c('mrate', 'age', 'sole', 'totemp')]

myfrm <- frm(y, x, linkfrac = 'logit')

*** Fractional logit regression model ***

           Estimate Std. Error t value Pr(>|t|)    
INTERCEPT  0.931699   0.084077  11.081    0.000 ***
mrate      0.952872   0.137079   6.951    0.000 ***
age        0.027934   0.004879   5.726    0.000 ***
sole       0.340332   0.080658   4.219    0.000 ***
totemp    -0.000008   0.000003  -2.701    0.007 ***

Now the GLM:

myglm <- glm(prate ~ mrate + totemp + age + sole, 
             data = df, family = quasibinomial('logit'))
coeftest(myglm, vcov.=vcovHC(myglm, type="HC0"))

z test of coefficients:

                 Estimate    Std. Error z value              Pr(>|z|)    
(Intercept)  0.9316994257  0.0840772572 11.0815 < 0.00000000000000022 ***
mrate        0.9528723652  0.1370808798  6.9512     0.000000000003623 ***
totemp      -0.0000082352  0.0000030489 -2.7011              0.006912 ** 
age          0.0279338963  0.0048785491  5.7259     0.000000010291017 ***
sole         0.3403324262  0.0806576852  4.2195     0.000024488075931 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

With HC0, the standard errors are identical. That is, frm uses HC0 by default. See this post for an extensive discussion. The defaults used by sandwich are probably better in some situations, though I would suspect that it does not matter much in general. You can see this already from your results: the differences are numerically very small.

You need to divide the prate variable by 100. You might also have to upgrade your version of frm.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!