R Under development (unstable) (2023-11-25 r85635 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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. > set.seed(789) > require("semtree") Loading required package: semtree Loading required package: OpenMx > data(lgcm) > > lgcm$agegroup <- ordered(lgcm$agegroup) > lgcm$training <- factor(lgcm$training) > lgcm$noise <- as.numeric(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") + ) > > > fr <- semforest(lgcModel, lgcm,control = semforest.control(num.trees = 3)) Beginning initial fit attempt Fit attempt 0, fit=3946.79931515407, new current best! (was 12364.5789577388) ✖ Variable noise is numeric but has only few unique values. Consider recoding as ordered factor. Beginning initial fit attempt Fit attempt 0, fit=2498.76798638632, new current best! (was 2500.57559046923) Beginning initial fit attempt Fit attempt 0, fit=764.772503388832, new current best! (was 1163.66565705693) Beginning initial fit attempt Fit attempt 0, fit=416.837040482736, new current best! (was 421.064350454217) Beginning initial fit attempt Fit attempt 0, fit=242.189878400202, new current best! (was 247.259525979077) Beginning initial fit attempt Fit attempt 0, fit=158.989241132224, new current best! (was 169.577514503669) Beginning initial fit attempt Fit attempt 0, fit=338.868295829069, new current best! (was 343.708152934567) Beginning initial fit attempt Fit attempt 0, fit=175.851011833291, new current best! (was 178.737405930515) Beginning initial fit attempt Fit attempt 0, fit=156.155329338792, new current best! (was 160.130889898547) Beginning initial fit attempt Fit attempt 0, fit=934.355396742766, new current best! (was 1335.10232932945) Beginning initial fit attempt Fit attempt 0, fit=447.459454932507, new current best! (was 473.567977479438) Beginning initial fit attempt Fit attempt 0, fit=219.981280075358, new current best! (was 222.72092756238) Beginning initial fit attempt Fit attempt 0, fit=221.207760644056, new current best! (was 224.738527370126) Beginning initial fit attempt Fit attempt 0, fit=444.014715095663, new current best! (was 460.787419263312) ✔ Tree construction finished [took 4s]. ✖ Variable noise is numeric but has only few unique values. Consider recoding as ordered factor. Beginning initial fit attempt Fit attempt 0, fit=2516.45260910031, new current best! (was 2517.92197726076) Beginning initial fit attempt Fit attempt 0, fit=1341.27576506242, new current best! (was 1348.10677650652) Beginning initial fit attempt Fit attempt 0, fit=648.879123954432, new current best! (was 651.186371311287) Beginning initial fit attempt Fit attempt 0, fit=687.549815244804, new current best! (was 690.089393751099) Beginning initial fit attempt Fit attempt 0, fit=1161.42709458488, new current best! (was 1168.34583259387) Beginning initial fit attempt Fit attempt 0, fit=704.468375444539, new current best! (was 708.478318204737) Beginning initial fit attempt Fit attempt 0, fit=174.029367790195, new current best! (was 300.378316294216) Beginning initial fit attempt Fit attempt 0, fit=279.420416612003, new current best! (was 404.090059150344) Beginning initial fit attempt Fit attempt 0, fit=446.634272024561, new current best! (was 452.948776380122) Beginning initial fit attempt Fit attempt 0, fit=106.498946931663, new current best! (was 206.168065374953) Beginning initial fit attempt Fit attempt 0, fit=152.335816309088, new current best! (was 240.466206649601) ✔ Tree construction finished [took 3s]. ✖ Variable noise is numeric but has only few unique values. Consider recoding as ordered factor. Beginning initial fit attempt Fit attempt 0, fit=2484.71604419055, new current best! (was 2486.93397274321) Beginning initial fit attempt Fit attempt 0, fit=840.478377838422, new current best! (was 1270.02577098119) Beginning initial fit attempt Fit attempt 0, fit=445.01443432754, new current best! (was 452.402766847605) Beginning initial fit attempt Fit attempt 0, fit=377.657268989177, new current best! (was 388.075610990863) Beginning initial fit attempt Fit attempt 0, fit=827.235462979423, new current best! (was 1214.6902732095) Beginning initial fit attempt Fit attempt 0, fit=421.274902028201, new current best! (was 425.650100976837) Beginning initial fit attempt Fit attempt 0, fit=192.799639085625, new current best! (was 203.327807811937) Beginning initial fit attempt Fit attempt 0, fit=209.819695597858, new current best! (was 217.947094216255) Beginning initial fit attempt Fit attempt 0, fit=395.839153642425, new current best! (was 401.585362002576) Beginning initial fit attempt Fit attempt 0, fit=194.650830045822, new current best! (was 201.29108770601) Beginning initial fit attempt Fit attempt 0, fit=188.88314455398, new current best! (was 194.548065936415) ✔ Tree construction finished [took 3s]. ✔ Forest completed [took 11s] > > > vimp <- varimp(fr) > > print(vimp) Variable Importance agegroup training noise 6750.524047 34.849488 -4.840519 > print(vimp, na.omit=TRUE) Variable Importance agegroup training noise 6750.524047 34.849488 -4.840519 > > varimpConvergencePlot(vimp, aggregate="mean") > varimpConvergencePlot(vimp, aggregate="median") > > > proc.time() user system elapsed 15.76 0.39 16.15