got this error
Error: mxPath() call will generate 2 paths but you have specified 3 values
Would be very helpful if the error could include the mxPath as coded to help find the bad path, for instance in a list of possible bad paths like this:
Error: mxPath() call will generate 2 paths but you have specified 3 values: mxPath(from= c("x","y"), arrows=2, free=TRUE, values=c(1, 1), labels=c("Varx","Vary"))
<
pre>
defModel<-mxModel("Def model", type="RAM",
mxData(myData, type="raw"),
manifestVars=c("x","y"),
latentVars="DefDummy",
mxPath(from=c("x","y"), arrows=2, free=TRUE, values=c(1,.1,1), labels=c("Varx","Vary")), # variances
mxPath(from="x", to="y", arrows=2, free=TRUE, values=c(.1), labels=c("Covxy")), # covariances
mxPath(from="one", to=c("x","y","DefDummy"), arrows=1, free=c(TRUE,TRUE,FALSE), values=c(1,1,1), labels =c("meanx","meany","data.def")), # means
mxPath(from="DefDummy", to=c("x","y"), arrows=1, free=c(TRUE,TRUE), values=c(1,1), labels =c("beta_1","beta_2")) # moderator paths
)
Comments
#1
Use traceback(). The problem is that if we always include the stack trace, then we'll get the complaint "OMG what is all this error output, it's so confusing." And the stacktrace is all or nothing, there's no such thing as a partial stacktrace.
#2
As a compromise the error message has been modified to print:
Error: mxPath() call will generate 2 paths but you have specified 3 values with 'from' argument assigned to 'x' and 'y' and 'to' argument assigned to 'NA'
#3
thanks michael! very helpful: anyone who reads that will be able to locate the problematic statement.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.