据我所知,逻辑模型和分数响应模型(frm)之间的区别在于,因变量(Y)其中frm为[0,1],而logistic为{0,1}。此外,frm使用拟似然估计器确定其参数。
通常,我们可以使用glm
来获得逻辑模型glm(y ~ x1+x2, data = dat, family = binomial(logit))
。
对于frm,我们更改family = binomial(logit)
为family = quasibinomial(logit)
。
我注意到我们也可以family = binomial(logit)
用来获取frm的参数,因为它给出了相同的估计值。请参阅以下示例
library(foreign)
mydata <- read.dta("k401.dta")
glm.bin <- glm(prate ~ mrate + age + sole + totemp, data = mydata
,family = binomial('logit'))
summary(glm.bin)
返回,
Call:
glm(formula = prate ~ mrate + age + sole + totemp, family = binomial("logit"),
data = mydata)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.1214 -0.1979 0.2059 0.4486 0.9146
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.074e+00 8.869e-02 12.110 < 2e-16 ***
mrate 5.734e-01 9.011e-02 6.364 1.97e-10 ***
age 3.089e-02 5.832e-03 5.297 1.17e-07 ***
sole 3.636e-01 9.491e-02 3.831 0.000128 ***
totemp -5.780e-06 2.207e-06 -2.619 0.008814 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1166.6 on 4733 degrees of freedom
Residual deviance: 1023.7 on 4729 degrees of freedom
AIC: 1997.6
Number of Fisher Scoring iterations: 6
而对于family = quasibinomial('logit')
,
glm.quasi <- glm(prate ~ mrate + age + sole + totemp, data = mydata
,family = quasibinomial('logit'))
summary(glm.quasi)
返回,
Call:
glm(formula = prate ~ mrate + age + sole + totemp, family = quasibinomial("logit"),
data = mydata)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.1214 -0.1979 0.2059 0.4486 0.9146
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.074e+00 4.788e-02 22.435 < 2e-16 ***
mrate 5.734e-01 4.864e-02 11.789 < 2e-16 ***
age 3.089e-02 3.148e-03 9.814 < 2e-16 ***
sole 3.636e-01 5.123e-02 7.097 1.46e-12 ***
totemp -5.780e-06 1.191e-06 -4.852 1.26e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for quasibinomial family taken to be 0.2913876)
Null deviance: 1166.6 on 4733 degrees of freedom
Residual deviance: 1023.7 on 4729 degrees of freedom
AIC: NA
Number of Fisher Scoring iterations: 6
两者的估计Beta family
值相同,但不同之处在于SE值。但是,要获得正确的SE,我们必须使用library(sandwich)
本文中的。
现在,我的问题是:
- 这两个代码有什么区别?
- frm是否即将获得强大的SE?
如果我的理解不正确,请提出一些建议。