> ### week 3 RQ2 ATT IPTW
## simplest version: logistic regression propensity, lm with weights outcome analysis
## alternative use twang for boosted regression and survey regression for weighted outcome
# form the weights using the match data for Lindner (weeks 2,3 sessions) initial steps from week 3 RQ1
> m2full.dat$weight.ATT = ifelse(m2full.dat$abcix == 1, 1, m2full.dat$distance/(1 - m2full.dat$distance))
# run the weighted t-test regression using lm with weights
> lm.IPTW_ATT = lm(log(cardbill) ~ abcix, data = m2full.dat, weights = (weight.ATT))
> summary(lm.IPTW_ATT)
Call:
lm(formula = log(cardbill) ~ abcix, data = m2full.dat, weights = (weight.ATT))
Weighted Residuals:
Min 1Q Median 3Q Max
-2.7180 -0.3496 -0.1476 0.1897 5.9240
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.50060 0.02269 418.709 <2e-16 ***
abcix 0.08098 0.03221 2.514 0.0121 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6038 on 994 degrees of freedom
Multiple R-squared: 0.00632, Adjusted R-squared: 0.00532
F-statistic: 6.322 on 1 and 994 DF, p-value: 0.01208
> exp(confint(lm.IPTW_ATT))
2.5 % 97.5 %
(Intercept) 12785.628904 13976.457279
abcix 1.017937 1.155085
> # about a dollar is what fullmatch also gave
> # don't know whether twang would show a bigger s.e., extra 'credit' try that