You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working with semtree.constraints and trying to use the global.invariance setting with the method = "score" option. However, I am encountering the following error:
Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent
I am unsure whether this issue arises due to a bug in the implementation or if the combination of global.invariance and method = "score" is mathematically not feasible. Could someone please clarify whether this setup is supposed to work, and if so, what might be causing the error?
I appreciate any insights or suggestions on how to address this issue.
Here is a reproducible example:
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")
)
#controlOptions <- semtree.control(method = "naive")
#controlOptions$alpha <- 0.05
controlOptions <- semtree.control(method = "score")
# RUN TREE.
tree <- semtree(model=lgcModel, data=lgcm, control = controlOptions)
# RERUN TREE WITH MODEL CONSTRAINTS.
# MODEL CONSTRAINTS CAN BE ADDED BY IDENTIFYING THE PARAMETERS TO BE
# CONSTRAINED IN EVERY NODE. ONLY UNCONSTRAINED PARAMETERS ARE THEN
# TESTED AT EACH NODE FOR GROUP DIFFERENCES. IN THIS EXAMPLE THE MODEL
# RESIDUALS ARE CONSTRAINED OVER THE NODES.
constraints <- semtree.constraints(global.invariance = names(omxGetParameters(lgcModel))[1:5])
treeConstrained <- semtree(model=lgcModel, data=lgcm, control = controlOptions,
constraints=constraints)```
The text was updated successfully, but these errors were encountered:
I can confirm the reported bug. There is no conceptual reason why this should not work. However, using 'global.invariance' is really only a shortcut to fix parameters at a certain value once before the SEM tree is estimated. Thus, it's almost never a good idea to use it, particularly, if you fix residual error variances -- it seems implausible that both reliability and modeling errors should remain constant across all possible sub groups. You may want to look into our latest development focus.parameters which are sets of parameters that are considered when splitting while all other parameters, which are not in focus, do not contribute to the split evaluation. A manuscript describing this approach is currently in the making. There is a vignette that demonstrates how it can be used (even though it doesn't tell you much more, yet).
Hello,
I am working with semtree.constraints and trying to use the global.invariance setting with the method = "score" option. However, I am encountering the following error:
I am unsure whether this issue arises due to a bug in the implementation or if the combination of global.invariance and method = "score" is mathematically not feasible. Could someone please clarify whether this setup is supposed to work, and if so, what might be causing the error?
I appreciate any insights or suggestions on how to address this issue.
Here is a reproducible example:
The text was updated successfully, but these errors were encountered: