Open Gootjes opened 11 months ago
Thanks for catching this! Do you have an example of a model that fails in this way, so we can decide how to handle this case?
It occurs as the amount of classes go up, and I guess also because I set a time limit on the models.
(Sidenote: with a time limit set to 1, it actually takes 3 * 1 minutes to finish because of the current try
logic trying harder twice after any kind of failure. I guess there is no logical way to check what kind of error occurred and return immediately on some types of errors?)
## Not run:
data("empathy")
df <- empathy[1:6][sample.int(nrow(empathy), size = 100*nrow(empathy), replace = T),]
mx_growth_mixture(model = "i =~ 1*ec1 + 1*ec2 + 1*ec3 +1*ec4 +1*ec5 +1*ec6
s =~ 0*ec1 + 1*ec2 + 2*ec3 +3*ec4 +4*ec5 +5*ec6
ec1 ~~ vec1*ec1
ec2 ~~ vec2*ec2
ec3 ~~ vec3*ec3
ec4 ~~ vec4*ec4
ec5 ~~ vec5*ec5
ec6 ~~ vec6*ec6
i ~~ 0*i
s ~~ 0*s
i ~~ 0*s",
classes = 10,
splits = c(10, sample.int(9, size = nrow(df)-1, replace = T)),
data = df, run = F) -> res
res <- mxOption(res, key = "Max minutes", value = 1)
m <- run_mx(res)
Running mix10 with 35 parameters
Running mix10 with 35 parameters
Error in if (res$output$maxRelativeOrdinalError > mxOption(NULL, "mvnRelEps")) { :
argument is of length zero
In addition: Warning messages:
1: In runHelper(model, frontendStart, intervals, silent, suppressWarnings, :
Time limit of 1 minutes 0 seconds exceeded
2: In runHelper(model, frontendStart, intervals, silent, suppressWarnings, :
Time limit of 1 minutes 0 seconds exceeded
MxModel objects happily let the user navigate to
res$output$maxRelativeOrdinalError
even thoughres$output
does not exist yet. This way,res$output$maxRelativeOrdinalError
can beNULL
if model estimations failed (badly), leading to an error at line 100 about comparing against a value that has length 0 (NULL).https://github.com/cjvanlissa/tidySEM/blob/7ab1d4c4f610da140cd25c72b98fc465b2100a5b/R/syntax-run.R#L100