Quick sanity-check for thresholded and survey-weighted models
Nick
Joined: 07/07/2026
Hi all,
I'm trying to run a set of models with a binary outcome variable that also incorporates some survey weights. I'm pretty sure that I'm misspecifying something somewhere (my standard errors are madness), but I'm not 100% sure where.
In building things out, I'm getting a few worrying error messages:
-when I try to run the umxThresholdMatrix, I'm getting an "Error in rep(TRUE, nThreshThisVar) : invalid 'times' argument"
-when I try to run the AutoStart, I'm getting an "Error: In model 'PMTMod' column 'unsecureOrd' is not an ordered factor. Use mxFactor() on this column."
-when I run the refModels, I'm getting an "Error: In model 'Saturated PMTMod' column 'unsecureOrd' is not an ordered factor. Use mxFactor() on this column."
Any chance one of you all could look over the code below to help me identify the issue?
Thanks!
******
pmt.std<-na.omit(pmt.std) %>%
zap_labels()
pmt.std$unsecureOrd<-mxFactor(pmt.std$unsecure, levels=c(0,1))
unsecureThreshold<-umx::umxThresholdMatrix(pmt.std, fullVarNames="unsecureOrd", method="Mehta")
PMTMod<-mxModel(model="PMTMod", type = "RAM",
manifestVars = c(ta.manifests, ca.manifests, pm.manifests, "unsecureOrd"),
latentVars = c("ThreatAppraisal", "CopingAppraisal", "ProtectionMotivation"),
mxPath(from = "ThreatAppraisal", to = ta.manifests, arrows = 1, free = T, values = .1),
mxPath(from = "ThreatAppraisal", to = ta.manifests[1], arrows = 1, free = F, values = 1),
mxPath(from = "CopingAppraisal", to = ca.manifests, arrows = 1, free = T, values = .1),
mxPath(from = "CopingAppraisal", to = ca.manifests[1], arrows = 1, free = F, values = 1),
mxPath(from = "ProtectionMotivation", to = pm.manifests, arrows = 1, free = T, values = .1),
mxPath(from = "ProtectionMotivation", to = pm.manifests[1], arrows = 1, free = F, values = 1),
mxPath(from = "ThreatAppraisal", to = "ProtectionMotivation", arrows = 1, free = T, values = .1, labels = "ThA"),
mxPath(from = "CopingAppraisal", to = "ProtectionMotivation", arrows = 1, free = T, values = .1, labels = "CoA"),
mxPath(from = "ThreatAppraisal", to = "CopingAppraisal", arrows = 2, free = T, values = .5, labels= "TCr"),
mxPath(from = "ProtectionMotivation", to = "unsecureOrd", arrows = 1, free = T, values = .1, labels = "B"),
mxPath(from = "ThreatAppraisal", to = "unsecureOrd", arrows = 1, free = T, values = .1, labels = "ThC"),
mxPath(from = "CopingAppraisal", to = "unsecureOrd", arrows = 1, free = T, values = .1, labels = "CoC"),
mxThreshold(vars="unsecureOrd", nThresh=1, free=T, values=0),
mxPath(from='one', to="unsecureOrd", free=FALSE, arrows=1, values=0),
mxPath(from="unsecureOrd", free=FALSE, arrows=2, values=1),
mxAlgebra(ThA * B, name = "ThAB"),
mxAlgebra(CoA * B, name = "CoAB"),
mxAlgebra(ThA * B + CoA * B, name = "ToTAB"),
mxPath(from=c(ta.manifests, ca.manifests, pm.manifests, "ThreatAppraisal", "CopingAppraisal", "ProtectionMotivation"), arrows=2, free=TRUE, values=.8, lbound=.0001),
mxPath(from='one', to=c(ta.manifests, ca.manifests, pm.manifests), arrows=1, free=TRUE, values=0),
mxData(observed = pmt.std, type = "raw", weight = "weight"),
mxCI(c("ThAB", "CoAB", "TCr", "B", "ThC", "CoC", "ToTAB"))
)
PMTAuto<-mxAutoStart(PMTMod)
PMTOut<-mxTryHard(PMTAuto, intervals = T)
PMTRef<-mxRefModels(PMTOut, run = T)
PMTFull<-summary(PMTOut, refModels=PMTRef)
An update - I've simplified…
An update - I've simplified the model to a place where the standard errors are making more sense, but I'm still not able to generate refModels for fit statistics.
I'm still getting the following error: "Error: In model 'Saturated PMTMod' column 'unsecureOrd' is not an ordered factor. Use mxFactor() on this column." even though, when I str(pmt.man$unsecureOrd), I get: "Ord.factor w/ 2 levels "0"<"1": 2 2 2 2 1 2 2 1 1 1 ..."
Any help in fixing this would be greatly appreciated.
##########################################
My code looks like the following:
pmt.man$unsecureOrd<-ordered(pmt.man$unsecure, levels=c(0,1))
PMTMMod<-mxModel(model="PMTMMod", type = "RAM",
manifestVars = c("threat", "coping", "protection", "unsecureOrd"),
mxPath(from = "threat", to = "protection", arrows = 1, free = T, values = .1, labels = "ThA"),
mxPath(from = "coping", to = "protection", arrows = 1, free = T, values = .1, labels = "CoA"),
mxPath(from = "threat", to = "coping", arrows = 2, free = T, values = .5, labels= "TCr"),
mxPath(from = "protection", to = "unsecureOrd", arrows = 1, free = T, values = .1, labels = "B"),
mxPath(from = "threat", to = "unsecureOrd", arrows = 1, free = T, values = .1, labels = "ThC"),
mxPath(from = "coping", to = "unsecureOrd", arrows = 1, free = T, values = .1, labels = "CoC"),
mxThreshold(vars="unsecureOrd", nThresh=1, free=T),
mxPath(from='one', to="unsecureOrd", free=FALSE, arrows=1, values=0),
mxPath(from="unsecureOrd", free=FALSE, arrows=2, values=1),
mxAlgebra(ThA * B, name = "ThAB"),
mxAlgebra(CoA * B, name = "CoAB"),
mxAlgebra(ThA * B + CoA * B, name = "ToTAB"),
mxPath(from=c("threat", "coping", "protection"), arrows=2, free=TRUE, values=.8, lbound=.0001),
mxPath(from='one', to=c("threat", "coping", "protection"), arrows=1, free=TRUE, values=0),
mxData(observed = pmt.man, type = "raw", weight = "weight"),
mxCI(c("ThA", "CoA", "ThAB", "CoAB", "TCr", "B", "ThC", "CoC", "ToTAB"))
)
PMTMOut<-mxTryHard(PMTMMod, intervals = T)
PMTMRef<-mxRefModels(PMTMOut, run = T)
Log in or register to post comments
Hi - Sorry you're having…
Hi - Sorry you're having trouble with this. I asked a friendly AI about the error, since without the data I cannot reproduce your error. The AI thinks that somehow it got corrupted on the way into the model, perhaps by being
d <- Saturated.PMTMod$data$observed # substitute the actual model-object name
class(d$unsecureOrd)
is.factor(d$unsecureOrd)
is.ordered(d$unsecureOrd)
levels(d$unsecureOrd)
str(d$unsecureOrd)
is.ordered(d$unsecureOrd)must beTRUE.A common cause is converting the data to a matrix, which cannot preserve a factor column alongside numeric columns:
# Risky: may destroy factor classes
mxData(as.matrix(pmt.man), type = "raw")
Other common causes are:
mxFactor()topmt.manbut supplying a different data frame to the model;ifelse(),as.numeric(),cbind(), or a data import/reshape step that strips the factor class;mxData;The safest sequence is:
pmt.man$unsecureOrd <- OpenMx::mxFactor(
pmt.man$unsecureOrd,
levels = c(0, 1)
)
stopifnot(is.ordered(pmt.man$unsecureOrd))
dataObj <- OpenMx::mxData(
observed = pmt.man, # keep this as a data.frame
type = "raw"
)
The decisive diagnostic is therefore not
str(pmt.man$unsecureOrd), which looks correct, but:is.ordered(Saturated.PMTMod$data$observed$unsecureOrd)
OpenMx requires each categorical column in the supplied raw data to remain an ordered factor. OpenMx ordinal-data documentation
Log in or register to post comments
In reply to Hi - Sorry you're having… by AdminNeale
Thanks! Sadly, this doesn't…
Thanks!
Sadly, this doesn't seem to be the root of the problem. is.ordered(pmt.man$unsecureOrd) is, in fact, TRUE, and re-running the safest-sequence above doesn't change the error that I'm getting for the Saturated model.
Sadly, I can't share the data, for DUA-type reasons. Anything else I could send along that would help to pinpoint the error?
Log in or register to post comments
Ok, chat to the rescue …
Ok, chat to the rescue (maybe) again:
Your binary-variable coding is correct.
ordered(..., levels = c(0, 1))is valid for OpenMx; replacing it withmxFactor()alone is unlikely to resolve this. OpenMx ordinal-data documentationThe error names “Saturated …”, so it points to the reference model created by:
Assuming
mxTryHard()finishes successfully, the next step is to build the reference models without running them and inspect their embedded data:run = FALSElets us inspect exactly whatmxRefModels()generated before the error occurs. Its implementation creates separate saturated and independence models, including their data objects. OpenMx sourceIf the fitted model returns
TRUEbut the saturated model returnsFALSE, that isolates the problem to reference-model construction. A potential workaround is to replace both reference models’ data with the correctly typed data from the fitted model, retaining the weights:Also, your original error says
"Saturated PMTMod", whereas this code names the model"PMTMMod". If that difference is literal, checkPMTMOut$name: you may be running an older model object.Please share the diagnostic outputs above—no individual observations are needed. If the saturated column already returns
TRUE, we should investigate further before treating the data replacement as a fix.Log in or register to post comments
In reply to Ok, chat to the rescue … by AdminNeale
Thanks for riding to my aid…
Thanks for riding to my aid.
Sadly, I think things are only going to get more complicated from here.
I have the diagnostics below (with a slightly-different model name, since we updated one of the analyses in the meanwhile).
***************
> packageVersion("OpenMx")
[1] ‘2.22.11’
PMTSMCRef<-mxRefModels(PMTSMCOut, run = T)
Error: In model 'Saturated PMTSMCMod' column 'unsecureOrd' is not an ordered factor. Use mxFactor() on this column.
> class(PMTSMCOut$data$observed$unsecureOrd)
[1] "ordered" "factor"
> is.ordered(PMTSMCOut$data$observed$unsecureOrd)
[1] TRUE
> SatCheck<-mxRefModels(PMTSMCOut, run = FALSE)
> names(SatCheck)
[1] "Saturated" "Independence"
> class(SatCheck$Saturated$data$observed)
[1] "tbl_df" "tbl" "data.frame"
> str(SatCheck$Saturated$data$observed$unsecureOrd)
Ord.factor w/ 2 levels "0"<"1": 2 2 2 2 1 2 2 1 1 1 ...
> is.ordered(SatCheck$Saturated$data$observed$unsecureOrd)
[1] TRUE
> SatCheck$Saturated$data$weight
[1] "weight"
> names(SatCheck$Saturated$data$observed)
[1] "threat" "coping" "secondary" "protection" "unsecureOrd" "agec18" "male" "black" "hispanic" "othrace"
[11] "married" "childhome" "ppeduc5" "ppinc7" "republican" "democrat" "urban" "suburban" "weight"
Log in or register to post comments
tibble
This,
, may highlight the root of the problem: your dataset is not only a dataframe, it is also a tibble. How are you loading and modifying your dataset? If you never turn it into a tibble, does the problem go away?
Log in or register to post comments
In reply to tibble by AdminRobK
tibble
I opened a new issue about this on our GitHub issue tracker. For now, I am pretty sure that not turning the dataset into a tibble will suffice as a workaround.
Log in or register to post comments
Almost fixed?
Thanks all - forcing the underlying data into a data.frame seems to have solved one part of the problem. The saturated model seems to run through, but when we get to the independence model, I'm getting the following error message:
In matrix(free, nrow, ncol, byrow = byrow) :
data length differs from size of matrix: [3838 != 1 x 1]
Hoping that this is something obvious that I'm overlooking - any thoughts on where to look again?
Log in or register to post comments
In reply to Almost fixed? by Nick
`traceback()`
Could you provide the output of
traceback()right after the error message? That is, when R stops what it's doing, prints the error message, and returns control to your R prompt, what do you get if you immediately runtraceback()?Log in or register to post comments
Traceback
I'm getting a "no traceback available" message when I run traceback() immediately after getting the error message.
Would it be at all useful to inspect the structure of the underlying dataset (now that it's been stripped of tibblehood), or should that not be relevant here?
Log in or register to post comments
In reply to Traceback by Nick
hmm
I see... So, I already know exactly where in the OpenMx frontend your error is getting thrown: line 36 of R/FullMatrix.R ; that is, OpenMx is trying to create an MxMatrix of
type="Full". Specifically, it looks as though OpenMx is trying to resize a matrix with 3838 elements into a matrix with 1 element. I just want to know what other frontend function calls preceded that line, so I know how control got there in the first place... That's why I asked abouttraceback(). I guess we'll figure out another diagnostic.Yeah, it could be. I note that you did not answer my question about how you are loading your dataset into R and (possibly) modifying it.
Does the number 3838 mean anything to you? Is that your sample size, or (say) the product of your sample size and number of variables?
Also--just checking--you haven't changed a specific one of OpenMx's R-frontend options from its default with `
options(mxCondenseMatrixSlots=TRUE)`, right?Log in or register to post comments
Structure and 3838
3838 represents the number of rows in the raw dataframe (which we originally loaded in via haven, since it came to us as a .dta).
I haven't touched any of the front-end options - I'm nowhere near foolish enough to mess around with something like that at random.
I have the full str() below in case it's useful - we centered all our continuous variables before entry, so there are a fair bit more attributes than normal...
str(pmt.man)
'data.frame': 3838 obs. of 52 variables:
$ weight : num 0.345 0.384 0.253 0.401 0.493 ...
..- attr(*, "label")= chr "Weights for all qualified respondents"
..- attr(*, "format.stata")= chr "%12.0g"
$ ppeduc5 : num -1.215 0.607 -0.304 -0.304 -1.215 ...
..- attr(*, "center")= num 3.33
..- attr(*, "scale")= num 1.1
..- attr(*, "robust")= logi FALSE
..- attr(*, "label")= chr "Education (5 Categories)"
$ ppinc7 : num -0.14 1.079 -0.749 -0.749 1.079 ...
..- attr(*, "center")= num 5.23
..- attr(*, "scale")= num 1.64
..- attr(*, "robust")= logi FALSE
..- attr(*, "label")= chr "Household Income"
$ carried : num 0 0 0 0 0 0 0 0 0 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ unsecure : num 1 1 1 1 0 1 1 0 0 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ owngun : num 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ accessible : 'dw_transformer' num 0.816 -0.361 0.816 0.816 0.816 ...
..- attr(*, "center")= num 2.31
..- attr(*, "scale")= num 0.85
..- attr(*, "robust")= logi FALSE
$ accessible_b : num 1 0 1 1 1 1 1 0 1 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ strangers : 'dw_transformer' num 0.818 0.818 0.818 0.818 -0.582 ...
..- attr(*, "center")= num 1.42
..- attr(*, "scale")= num 0.714
..- attr(*, "robust")= logi FALSE
$ pplknown : 'dw_transformer' num -0.602 -0.602 -0.602 -0.602 -0.602 ...
..- attr(*, "center")= num 0.391
..- attr(*, "scale")= num 0.649
..- attr(*, "robust")= logi FALSE
$ unrest : 'dw_transformer' num 1.068 -1.552 -0.242 -1.552 -0.242 ...
..- attr(*, "center")= num 1.18
..- attr(*, "scale")= num 0.763
..- attr(*, "robust")= logi FALSE
$ authority : 'dw_transformer' num 0.625 -0.724 0.625 -0.724 -0.724 ...
..- attr(*, "center")= num 0.537
..- attr(*, "scale")= num 0.741
..- attr(*, "robust")= logi FALSE
$ q5j2a : num 4 2 2 4 2 3 4 3 3 2 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2b : num 4 3 2 4 2 2 4 3 3 2 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2c : num 4 2 2 4 2 2 2 3 3 2 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2d : num 4 2 2 4 2 0 4 3 3 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2e : num 4 3 2 4 2 2 4 3 0 2 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2f : num 4 1 2 4 2 0 2 2 0 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2g : num 4 1 2 4 2 0 2 2 0 1 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ q5j2h : num 4 1 2 4 2 0 2 2 0 1 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ dgu : 'dw_transformer' num -0.659 -0.659 -0.659 0.227 -0.659 ...
..- attr(*, "center")= num 0.743
..- attr(*, "scale")= num 1.13
..- attr(*, "robust")= logi FALSE
$ male : num 0.689 0.689 -1.452 -1.452 0.689 ...
..- attr(*, "center")= num 0.678
..- attr(*, "scale")= num 0.467
..- attr(*, "robust")= logi FALSE
$ white : num 1 1 1 1 1 0 0 0 1 1 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ black : num -0.308 -0.308 -0.308 -0.308 -0.308 ...
..- attr(*, "center")= num 0.0865
..- attr(*, "scale")= num 0.281
..- attr(*, "robust")= logi FALSE
$ hispanic : num -0.28 -0.28 -0.28 -0.28 -0.28 ...
..- attr(*, "center")= num 0.073
..- attr(*, "scale")= num 0.26
..- attr(*, "robust")= logi FALSE
$ othrace : num -0.254 -0.254 -0.254 -0.254 -0.254 ...
..- attr(*, "center")= num 0.0607
..- attr(*, "scale")= num 0.239
..- attr(*, "robust")= logi FALSE
$ married : num -1.43 0.699 0.699 0.699 0.699 ...
..- attr(*, "center")= num 0.672
..- attr(*, "scale")= num 0.47
..- attr(*, "robust")= logi FALSE
$ empower : num 4 1.88 2 4 2 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ ul_utility : 'dw_transformer' num 1.506 -0.155 -0.986 0.675 -0.155 ...
..- attr(*, "center")= num 2.19
..- attr(*, "scale")= num 1.2
..- attr(*, "robust")= logi FALSE
$ gunhomesafer : 'dw_transformer' num 0.826 -1.211 0.826 0.826 0.826 ...
..- attr(*, "center")= num 0.595
..- attr(*, "scale")= num 0.491
..- attr(*, "robust")= logi FALSE
$ preventable : 'dw_transformer' num -0.237 -0.237 -0.237 -0.237 -0.237 ...
..- attr(*, "center")= num 0.117
..- attr(*, "scale")= num 0.494
..- attr(*, "robust")= logi FALSE
$ anyprevent : num 0 0 0 0 0 0 0 0 0 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ childhome : num -0.549 1.821 -0.549 -0.549 -0.549 ...
..- attr(*, "center")= num 0.232
..- attr(*, "scale")= num 0.422
..- attr(*, "robust")= logi FALSE
$ urban : num -0.658 -0.658 1.519 -0.658 1.519 ...
..- attr(*, "center")= num 0.302
..- attr(*, "scale")= num 0.459
..- attr(*, "robust")= logi FALSE
$ suburban : num 1.229 1.229 -0.814 1.229 -0.814 ...
..- attr(*, "center")= num 0.398
..- attr(*, "scale")= num 0.49
..- attr(*, "robust")= logi FALSE
$ rural : num 0 0 0 0 0 0 0 0 0 1 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ republican : num 1.105 -0.904 1.105 1.105 -0.904 ...
..- attr(*, "center")= num 0.45
..- attr(*, "scale")= num 0.498
..- attr(*, "robust")= logi FALSE
$ democrat : num -0.514 1.945 -0.514 -0.514 -0.514 ...
..- attr(*, "center")= num 0.209
..- attr(*, "scale")= num 0.407
..- attr(*, "robust")= logi FALSE
$ agec18 : num 0.8749 0.0459 0.2372 1.1938 0.4285 ...
..- attr(*, "center")= num 38.3
..- attr(*, "scale")= num 15.7
..- attr(*, "robust")= logi FALSE
$ protectss : num 5 2 4 2 2 2 8 4 4 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ moregunsafenh: 'dw_transformer' num -0.669 -0.669 -0.669 1.494 1.494 ...
..- attr(*, "center")= num 0.309
..- attr(*, "scale")= num 0.462
..- attr(*, "robust")= logi FALSE
$ earlyshoot : 'dw_transformer' num 0.824 -1.213 -1.213 0.824 0.824 ...
..- attr(*, "center")= num 0.595
..- attr(*, "scale")= num 0.491
..- attr(*, "robust")= logi FALSE
$ shootfreq : 'dw_transformer' num -0.711 0.651 -0.711 0.651 0.651 ...
..- attr(*, "center")= num 0.522
..- attr(*, "scale")= num 0.734
..- attr(*, "robust")= logi FALSE
$ gunsecurity : 'dw_transformer' num 1.299 -0.601 -0.981 1.299 -0.981 ...
..- attr(*, "center")= num 2.86
..- attr(*, "scale")= num 0.877
..- attr(*, "robust")= logi FALSE
$ homiciderisk : 'dw_transformer' num -1.05 -0.1 -1.05 -0.1 -1.05 ...
..- attr(*, "center")= num 1.11
..- attr(*, "scale")= num 1.05
..- attr(*, "robust")= logi FALSE
$ gundanger : num 0 0 0 0 0 0 0 0 0 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ flag_m : num 0 0 0 0 0 0 0 0 0 0 ...
..- attr(*, "format.stata")= chr "%12.0g"
$ threat : num 0.273 -0.852 -0.102 -0.477 -0.852 ...
..- attr(*, "center")= num 0.854
..- attr(*, "scale")= num 0.533
..- attr(*, "robust")= logi FALSE
$ coping : num -0.0155 -0.7499 -0.7499 1.4534 1.4534 ...
..- attr(*, "center")= num 0.505
..- attr(*, "scale")= num 0.34
..- attr(*, "robust")= logi FALSE
$ protection : num 1.71 -0.479 -0.636 1.241 -0.166 ...
..- attr(*, "center")= num 2.45
..- attr(*, "scale")= num 0.71
..- attr(*, "robust")= logi FALSE
$ secondary : num -1.014 -0.185 -1.014 -0.185 -1.014 ...
..- attr(*, "center")= num 0.611
..- attr(*, "scale")= num 0.603
..- attr(*, "robust")= logi FALSE
$ unsecureOrd : Ord.factor w/ 2 levels "0"<"1": 2 2 2 2 1 2 2 1 1 1 ...
..- attr(*, "mxFactor")= logi TRUE
Log in or register to post comments
In reply to Structure and 3838 by Nick
Try again without weights?
We had another idea: what happens if you try running everything without the weights? If doing that works, then we can be pretty sure there's a problem with how the sampling weights are being handled.
Log in or register to post comments
Removing Weights
Sadly, removing the weights does not fix anything - I get the same error when OpenMx tries to calculate the Independence model:
Warning message:
In matrix(free, nrow, ncol, byrow = byrow) :
data length differs from size of matrix: [3838 != 1 x 1].
Here's what the model-output looks like (for this most recent run without weights):
$Saturated
MxModel 'Saturated test'
type : default
$matrices : 'satCov', 'satMea', 'thresholdDeviations', and 'unitLower'
$algebras : 'thresholdMatrix'
$penalties : NULL
$constraints : NULL
$intervals : NULL
$latentVars : none
$manifestVars : none
$data : 3838 x 18
$data means : NA
$data type: 'raw'
$submodels : NULL
$expectation : MxExpectationNormal
$fitfunction : MxFitFunctionML
$compute : MxComputeSequence
$independent : FALSE
$options : 'Standard Errors' = 'No', 'Calculate Hessian' = 'No'
$output : TRUE
$Independence
MxModel 'Independence test'
type : default
$matrices : 'indCov', 'satMea', 'thresholdDeviations', and 'unitLower'
$algebras : 'thresholdMatrix'
$penalties : NULL
$constraints : NULL
$intervals : NULL
$latentVars : none
$manifestVars : none
$data : 3838 x 18
$data means : NA
$data type: 'raw'
$submodels : NULL
$expectation : MxExpectationNormal
$fitfunction : MxFitFunctionML
$compute : MxComputeSequence
$independent : FALSE
$options : 'Standard Errors' = 'No', 'Calculate Hessian' = 'No'
$output : TRUE
Log in or register to post comments
In reply to Removing Weights by Nick
warning, not error?
Hang on...that's a warning rather than an error? If so, that would explain why
traceback()didn't work--there was no error to trace.If
mxRefModels()is indeed outputting the list of the two reference models, you could look inPMTMRef$Independence@matricesand see which matrices are 1x1; that might give you a hint as to why you're seeing that message.If you're really getting a warning and not an error, then R isn't stopping your script from running. Do your results look reasonable?
Log in or register to post comments
1x1 Matrix
Thanks!
When I look at the matricies, it seems like the 1x1 is $values - I've got the output pasted below. Unsurprisingly, when I try to use the RefModels in a summary(), none of the fit indices are being calculated.
> PMTMRef$Independence@matrices
$indCov
DiagMatrix 'indCov'
$labels: No labels assigned.
$values
threat coping protection unsecureOrd
threat 1 0 0 0
coping 0 1 0 0
protection 0 0 1 0
unsecureOrd 0 0 0 1
$free
threat coping protection unsecureOrd
threat TRUE FALSE FALSE FALSE
coping FALSE TRUE FALSE FALSE
protection FALSE FALSE TRUE FALSE
unsecureOrd FALSE FALSE FALSE FALSE
$lbound
threat coping protection unsecureOrd
threat 0 NA NA NA
coping NA 0 NA NA
protection NA NA 0 NA
unsecureOrd NA NA NA 0
$ubound: No upper bounds assigned.
$satMea
FullMatrix 'satMea'
$labels: No labels assigned.
$values
threat coping protection unsecureOrd
<NA> 0 0 0 0
$free
threat coping protection unsecureOrd
<NA> TRUE TRUE TRUE FALSE
$lbound: No lower bounds assigned.
$ubound: No upper bounds assigned.
$thresholdDeviations
FullMatrix 'thresholdDeviations'
$labels
unsecureOrd
[1,] "unsecureOrdThrDev1"
$values
unsecureOrd
[1,] 0.2
$free
unsecureOrd
[1,] TRUE
$lbound
unsecureOrd
[1,] -Inf
$ubound: No upper bounds assigned.
$unitLower
LowerMatrix 'unitLower'
$labels: No labels assigned.
$values
[,1]
[1,] 1
$free: No free parameters.
$lbound: No lower bounds assigned.
$ubound: No upper bounds assigned.
Log in or register to post comments
In reply to 1x1 Matrix by Nick
When I look at the matricies…
'values' is just one of the five ordinary R matrices that an MxMatrix contains: 'values', 'labels', 'free', 'lbound', and 'ubound'. Those five matrices will all have the same dimensions (unless you have done
options(mxCondenseMatrixSlots=TRUE)or have passed argumentcondenseSlots=TRUEtomxMatrix()--which is why I previously asked about that option). Theprintmethod for the MxMatrix model class simply doesn't print out the 'labels', 'free', 'lbound', and 'ubound' matrices if there's nothing interesting about them. You can take a detailed look at an MxMatrix with thestr()function and see what I mean. For instance, it will show you that all five constituent matrices of MxMatrix "UnitLower" are 1x1.Something doesn't seem right here. I do find it surprising that you are not seeing fit indices, even though you are able to create the RefModels (correct?). Could you explain further, and show me exactly what syntax you're using--specifically, your call to
summary()?Log in or register to post comments
In reply to When I look at the matricies… by AdminRobK
Sorry for my imprecision -…
Sorry for my imprecision - when I look at the fit indices, here's what I'm seeing:
CFI: 1
TLI: NA (also known as NNFI)
RMSEA: NA [95% CI (NA, NA)]
Prob(RMSEA <= 0.05): NA
So, things are technically being calculated, but are returning no meaningful value
[here's my summary() syntax: PMTSMCFull<-summary(PMTSMCOut, refModels=PMTSMCRef)
Log in or register to post comments