'mediate.ced' estimates the average causal mediation effects for the crossover encouragement design.
mediate.ced(outcome, med.1, med.2, treat, encourage, data, sims = 1000,
conf.level = 0.95)
variable name in 'data' containing the outcome values observed in the second experiment. The variable must be binary (factor or numeric 0/1).
variable name in 'data' containing the mediator values observed in the first experiment. The variable must be binary (factor or numeric 0/1).
variable name in 'data' containing the mediator values observed in the second experiment.
variable name in 'data' containing the treatment values in the first experiment. Must be binary (factor or numeric 0/1).
name of the encouragement indicator in 'data'. Must be binary (factor or numeric 0/1).
a data frame containing all the above variables.
number of bootstrap simulations.
level of the returned two-sided confidence intervals.
mediate.ced
returns an object of class
"mediate.design
", a list that contains the components listed below.
The summary
function can be used to obtain a table of the results.
point estimates of the average indirect effects under the control and treatment conditions.
confidence intervals for the effects. The confidence level is set at the value specified in 'conf.level'.
confidence level used.
number of bootstrap simulations.
number of observations used.
indicates the design. Always equals "CED".
This function estimates the average indirect effects for the pliable units under the crossover encouragement design. The design has two stages. In the first stage the treatment is randomized and the mediator and outcome variables are measured. In the second the treatment is set to the value opposite of first period and a randomly selected group of units receives encouragement to take on the mediator opposite to the values observed in the first stage. See Imai, Tingley and Yamamoto (2012) for a full description. The confidence intervals are calculated via the nonparametric bootstrap.
Note that outcome
should be the observed responses in the
second stage whereas treat
should be the values in the
first stage.
Tingley, D., Yamamoto, T., Hirose, K., Imai, K. and Keele, L. (2014). "mediation: R package for Causal Mediation Analysis", Journal of Statistical Software, Vol. 59, No. 5, pp. 1-38.
Imai, K., Tingley, D. and Yamamoto, T. (2012) Experimental Designs for Identifying Causal Mechanisms. Journal of the Royal Statistical Society, Series A (Statistics in Society)"
Imai, K., Keele, L., Tingley, D. and Yamamoto, T. (2011). Unpacking the Black Box of Causality: Learning about Causal Mechanisms from Experimental and Observational Studies, American Political Science Review, Vol. 105, No. 4 (November), pp. 765-789.
Imai, K., Keele, L. and Yamamoto, T. (2010) Identification, Inference, and Sensitivity Analysis for Causal Mediation Effects, Statistical Science, Vol. 25, No. 1 (February), pp. 51-71.
Imai, K., Keele, L., Tingley, D. and Yamamoto, T. (2009) Causal Mediation Analysis Using R" in Advances in Social Science Research Using R, ed. H. D. Vinod New York: Springer.
# NOT RUN {
data(CEDdata)
res <- mediate.ced("Y2", "M1", "M2", "T1", "Z", CEDdata, sims = 100)
summary(res)
# }
Run the code above in your browser using DataLab