DesignLibrary
DesignLibrary copied to clipboard
Allow for confounding in pretest-posttest
Something like the following, although need to think through decomposition of error term and how to specify correlation between Z and these. The below gives very different results for tradeoff between estimators depending on whether Z is given u_t1 or u_t2, for example. See: https://www.jstor.org/stable/271083?seq=10#page_scan_tab_contents
population <- declare_population(
N = N,
u_t1 = rnorm(N) *
sd_1,
u_t2 = rnorm(N, rho * u_t1, sqrt(1 - rho^2)) * sd_2,
Y_t1 = u_t1,
Z = correlate(N = N, prob = .5,draw_handler = draw_binary,given = u_t2,rho = confounding))
potentials_t2 <- declare_potential_outcomes(Y_t2 ~ u_t2 +
ate * Z)
estimand <- declare_estimand(ATE = mean(Y_t2_Z_1 - Y_t2_Z_0))
report <- declare_assignment(m = round(N * (1 - attrition_rate)),
assignment_variable = R)
reveal_t2 <- declare_reveal(Y_t2)
manipulation <- declare_step(difference = (Y_t2 - Y_t1),
handler = fabricate)
pretest_lhs <- declare_estimator(difference ~ Z, model = lm_robust,
estimand = estimand, subset = R == 1, label = "Change score")
pretest_rhs <- declare_estimator(Y_t2 ~ Z + Y_t1, model = lm_robust,
estimand = estimand, subset = R == 1, label = "Condition on pretest")
posttest_only <- declare_estimator(Y_t2 ~ Z, model = lm_robust,
estimand = estimand, label = "Posttest only")
pretest_posttest_design <- population + potentials_t2 + estimand +
reveal_t2 + report + manipulation + pretest_lhs +
pretest_rhs + posttest_only