MplusTrees: Recursive partitioning trees with Mplus models

Description Usage Arguments Details Examples

Description

Generates recursive partitioning trees using Mplus models. MplusTrees() takes an Mplus model written in the form of an MplusAutomation script, uses MplusAutomation to fit the model in Mplus, and performs recursive partitioning using rpart.

Usage

1
2
MplusTrees(script, data, rPartFormula, catvars = NULL, group = ~id,
  control = rpart.control(), se = F, psplit = F, palpha = 0.05)

Arguments

script

An MplusAutomation script file

data

Dataset that is specified in the script

rPartFormula

Formula of the form ~ variable names

catvars

Vector of names of categorical covariates

group

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

control

Control object for rpart.

se

Whether to print standard errors and p values. In general should be set to FALSE.

psplit

Whether to use likelihood ratio p values as a splitting criterion

palpha

Type I error rate (alpha level) for rejecting with likelihood ratio test when psplit set to TRUE

Details

In the fitted object, rpart_out provides the tree structure, terminal gives a vector of terminal nodes, where shows the terminal node of each id, and estimates gives the parameter estimates for each terminal node.

By default MplusTrees() only splits on the criteria specified in the control argument, the most important of which is the cp parameter. However, the user can also split on the p value generated from the likelihood ratio test comparing the parent node to a multiple group model consisting of 2 groups (the daughter nodes). This p value criterion is used in addition to the cp criterion in that both must be met for a split to be made. The psplit argument turns this option on, palpha sets the alpha level criterion for rejection.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(lavaan)

script = mplusObject(
   TITLE = "Example #1 - Factor Model;",
   MODEL = "f1 BY x1-x3; f2 BY x4-x6; f3 BY x7-x9;",
   usevariables = c('x1','x2','x3','x4','x5','x6','x7','x8','x9'),
   rdata = HolzingerSwineford1939)

fit = MplusTrees(script, HolzingerSwineford1939, group=~id,
   rPartFormula=~sex+school+grade, control=rpart.control(cp=.01))

fit

## End(Not run)

Rjacobucci/MplusTrees documentation built on July 5, 2019, 11:51 a.m.