R Under development (unstable) (2025-07-27 r88459 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require(semtree) Loading required package: semtree Loading required package: OpenMx > > > data(lgcm) > > lgcm$agegroup <- ordered(lgcm$agegroup, labels=c("young","old") ) > lgcm$training <- as.factor(lgcm$training) > lgcm$noise <- as.factor(lgcm$noise) > > # LOAD IN OPENMX MODEL. > # A SIMPLE LINEAR GROWTH MODEL WITH 5 TIME POINTS FROM SIMULATED DATA > > manifests <- names(lgcm)[1:5] > lgcModel <- mxModel("Linear Growth Curve Model Path Specification", + type="RAM", + manifestVars=manifests, + latentVars=c("intercept","slope"), + # residual variances + mxPath( + from=manifests, + arrows=2, + free=TRUE, + values = c(1, 1, 1, 1, 1), + labels=c("residual1","residual2","residual3","residual4","residual5") + ), + # latent variances and covariance + mxPath( + from=c("intercept","slope"), + connect="unique.pairs", + arrows=2, + free=TRUE, + values=c(1, 1, 1), + labels=c("vari", "cov", "vars") + ), + # intercept loadings + mxPath( + from="intercept", + to=manifests, + arrows=1, + free=FALSE, + values=c(1, 1, 1, 1, 1) + ), + # slope loadings + mxPath( + from="slope", + to=manifests, + arrows=1, + free=FALSE, + values=c(0, 1, 2, 3, 4) + ), + # manifest means + mxPath( + from="one", + to=manifests, + arrows=1, + free=FALSE, + values=c(0, 0, 0, 0, 0) + ), + # latent means + mxPath( + from="one", + to=c("intercept", "slope"), + arrows=1, + free=TRUE, + values=c(1, 1), + labels=c("meani", "means") + ), + mxData(lgcm,type="raw") + ) > > > # TREE CONTROL OPTIONS. > # TO OBTAIN BASIC/DEFAULT SMETREE OPTIONS, SIMPLY TPYE THE FOLLOWING: > > controlOptions <- semtree.control(method = "naive",max.depth = 0,min.N=NULL, + min.bucket=NULL) > > # RUN TREE. > > tree <- semtree(model=lgcModel, data=lgcm, control = controlOptions) ❯ Model was not run. Estimating parameters now. Beginning initial fit attempt Fit attempt 0, fit=3946.79931515402, new current best! (was 12364.5789577388) Beginning initial fit attempt Fit attempt 0, fit=3946.79931515399, new current best! (was 3946.79931515402) ✔ Tree construction finished [took less than a second]. > > stopifnot(tree$control$min.N==50) > stopifnot(tree$control$min.bucket==25) > > > > x<-semtree_control() > semtree:::check.semtree.control(x) [1] TRUE > > x<-semtree_control(min.N=100) > semtree:::check.semtree.control(x) [1] TRUE > > x<-semtree_control(min.N=100, min.bucket=10) > semtree:::check.semtree.control(x) [1] TRUE > > proc.time() user system elapsed 3.53 0.57 4.03