我想知道权重的处理之间的区别svyglm
和glm
我正在twang
R中使用软件包创建倾向得分,然后将其用作权重,如下所示(此代码来自twang
文档):
library(twang)
library(survey)
set.seed(1)
data(lalonde)
ps.lalonde <- ps(treat ~ age + educ + black + hispan + nodegree + married + re74 + re75,
data = lalonde)
lalonde$w <- get.weights(ps.lalonde, stop.method="es.mean")
design.ps <- svydesign(ids=~1, weights=~w, data=lalonde)
glm1 <- svyglm(re78 ~ treat, design=design.ps)
summary(glm1)
...
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6685.2 374.4 17.853 <2e-16 ***
treat -432.4 753.0 -0.574 0.566
比较一下:
glm11 <- glm(re78 ~ treat, weights=w , data=lalonde)
summary(glm11)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6685.2 362.5 18.441 <2e-16 ***
treat -432.4 586.1 -0.738 0.461
因此,参数估计值相同,但处理的标准误却大不相同。
svyglm
和之间的重量处理glm
有何不同?
surveyglm
?