Description Usage Format Details Source See Also Examples
Subset of data from Gaines and Kuklinski (2011)
1 |
The treatment indicator, where 1=treatment, 2=control, 3=chose treatment, 4=chose control.
A “feeling thermometer” toward John McCain.
A “feeling thermometer” toward Barack Obama.
An indicator of party identification, where -1=Republican, 0=Independent, 1=Democrat.
This dataset contains a subset of variables, extracted from the dataset used by Gaines and Kuklinski (2011).
Brian J. Gaines and James H. Kuklinski, (2011), "Experimental Estimation of Heterogeneous Treatment Effects Related to Self-Selection," American Journal of Political Science 55(3): 724-736.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | data(ajps)
# replicate Gaines and Kuklinski (2011) Table 2
pmean <- function(x) sprintf("%0.1f", mean(x))
cbind(
# Democrats
aggregate(cbind(therm.mccain, therm.obama) ~ tr,
data = ajps[ajps$pid == 1, ], FUN = pmean)[, 1:3],
n_dem = aggregate(therm.obama ~ tr,
data = ajps[ajps$pid == 1, ], FUN = length)[, 2],
# Republicans
aggregate(cbind(therm.mccain, therm.obama) ~ tr,
data = ajps[ajps$pid == -1, ], FUN = pmean)[, 2:3],
n_rep = aggregate(therm.obama ~ tr,
data = ajps[ajps$pid == -1, ], FUN = length)[, 2]
)
# effects for McCain among Democrats
with(ajps[ajps$pid == 1, ], {
estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.mccain)
})
# effects for McCain among Republicans
with(ajps[ajps$pid == -1, ], {
estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.mccain)
})
# effects for Obama among Democrats
with(ajps[ajps$pid == 1, ], {
estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.obama)
})
# effects for Obama among Republicans
with(ajps[ajps$pid == -1, ], {
estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.obama)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.