-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
126 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
require(semtree) | ||
|
||
|
||
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) | ||
|
||
stopifnot(tree$control$min.N==50) | ||
stopifnot(tree$control$min.bucket==25) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters