The semtree package provides various stopping rules as described in Brandmaier et al. (2013). These include a naive splitting criterion based on the likelihood ratio test, which suffers from variable selection bias. A fair splitting criterion, which corrects for the bias at the cost of lower power. A cross-validation criterion, which estimates the expected likelihood ratio and stops based on an empirical threshold.

Users can implement custom stopping rules for SEM trees easily. The custom rule is to implemented in the control object. The following example illustrates how a stopping rule can be

implemented that is based on the ratio of the negative two log likelihood ratio and the degrees of freedom of the model.

In the first line, the default control object is created. In the second line, the stopping criterion is formalized as a function, which takes as input the current node object, a result object containing information about the possible splits and the control object. The node object contains information about the best split -2LL (node$lr) and the degrees of freedom of the model (node$df). The example below stops splitting if the ratio of -2LL and df is below 100.

control <- semtree.control() control$custom.stopping.rule <- function(node, result, control) { return( node$lr/node$df <- 100) }

References:

Brandmaier, A. M., Oertzen, T. v., McArdle, J. J., & Lindenberger, U. (2013). Structural equation model trees. Psychological Methods, *18*, 71-86. doi: 10.1037/a0030001