我正在关注这张幻灯片中R的倾向得分匹配并得到错误:“未知参数lpha”
这是我的代码:
data(lalonde, package = 'Matching')
lalonde.formu <- treat ~ age + educ + black + hisp + married + nodegr + re74 + re75
glm1 <- glm(lalonde.formu, family = binomial, data = lalonde)
library(Matching)
ps <- fitted(glm1) # Propensity scores
Y <- lalonde$re78 # Dependent variable, real earnings in 1978
Tr <- lalonde$treat # Treatment indicator
rr <- Match(Y=Y, Tr=Tr, X=ps, M=1, ties=FALSE)
summary(rr) # The default estimate is ATT here
library(granovaGG)
matches <- data.frame(Treat=lalonde[rr$index.treated, 're78'], Control=lalonde[rr$index.control, 're78'])
print(granovagg.ds(matches))
我做错了什么?