Learn R Programming

MplusTrees (version 0.2.3)

causalmpt: Causal Mplus Trees

Description

Uses Mplus Trees to match on structural equation model parameters in matching subsample. Then estimates Conditional Average Treatment Effects (CATEs) in holdout estimation subsample.

Usage

causalmpt(
  script,
  data,
  rPartFormula,
  group = ~id,
  treat,
  outcome,
  est.samp = 0.2,
  ...
)

Value

An object of class 'causalmpt'. Tree structure drawn from MplusTrees(). CATEs estimated in estimation (holdout) subsample. Provides results of t tests to estimate CATEs in each group and ANOVA to examine group differences in treatment effect.

Arguments

script

An MplusAutomation script file

data

Dataset that is specified in the script

rPartFormula

Formula of the form ~ variable names

group

id variable. If not specified an id variable is created for each row

treat

Treatment variable

outcome

Univariate outcome of interest (dependent variable in mean comparison tests)

est.samp

Proportion of sample to be used as holdout sample (estimation subsample)

...

Other arguments to MplusTrees for building Mplus Tree

Author

Sarfaraz Serang

Details

See documentation for MplusTrees() for further information on tree building process. Takes terminal nodes from Mplus Tree and considers them "matched". Splits estimation subsample into groups defined by covariate pattern in terminal nodes from Mplus Tree. Performs t tests in each group with treat as independent variable and outcome as dependent variable to estimate CATEs. Also performs ANOVA to determine if treatment effect differs by group (interaction).

References

Serang, S., & Sears, J. (2021). Tree-based matching on structural equation model parameters. Behavioral Data Science, 1, 31-53.

Examples

Run this code
if (FALSE) {
library(lavaan)

script = mplusObject(
   TITLE = "Causal Mplus Trees Example",
   MODEL = "f1 BY x1-x3;",
   usevariables = c('x1','x2','x3'),
   rdata = HolzingerSwineford1939)

fit.cmpt = causalmpt(script, HolzingerSwineford1939, group=~id,
   rPartFormula=~school+grade,
   control=rpart.control(minsplit=100, minbucket=100, cp=.01),
   treat="sex", outcome="x4")
fit.cmpt
}

Run the code above in your browser using DataLab