You are here

negative variance in factor representing change in anxiety (latent factor)

2 posts / 0 new
Last post
rranne2@uic.edu's picture
Offline
Joined: 12/11/2018 - 00:08
negative variance in factor representing change in anxiety (latent factor)
AttachmentSize
Image icon new model27.62 KB
Image icon original model29.57 KB

Hello there!

I'm having trouble with a model investigating change in anxiety over time. In the future, I will be building out a more complex model with other factors predicting change in anxiety over time, but I'm now just at a step before that looking into a model with only change in anxiety over time--only for two time points.

Even before I did this step, I looked into invariance over time for the items that make up the latent factor of anxiety at both time points. This was a brief four item measure of anxiety. That initial test looked good with positive variances and a good fit.

I used the method to form a latent change factor using the McArdle method from his 2009 paper "Latent Variable Modeling of Differences and Changes with Longitudinal Data." However, I was getting negative variance when I did this. This is the code for this model (I have attached the visual for this original model):

Finalmodelanxietystep2<-mxModel(model="finalmodelanxietystep2", type="RAM", manifestVars=manifests, latentVars=latents, 
mxPath(from="Time2anxiety", to="Time2anxiety_1a", arrows=1, free=TRUE, values=0.8476268, labels=c("anxanx1a")), 
mxPath(from="Time2anxiety", to="Time2anxiety_1b", arrows=1, free=TRUE, values=0.8577030, labels=c("anxanx1b")), 
mxPath(from="Time2anxiety", to="Time2anxiety_1f", arrows=1, free=TRUE, values=0.8541549, labels=c("anxanx1f")), 
mxPath(from="Time2anxiety", to="Time2anxiety_1h", arrows=1, free=TRUE, values=0.8378001, labels=c("anxanx1h")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1a", arrows=1, free=TRUE, values=0.8476268, labels=c("anxanx1a")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1b", arrows=1, free=TRUE, values=0.8577030, labels=c("anxanx1b")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1f", arrows=1, free=TRUE, values=0.8541549, labels=c("anxanx1f")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1h", arrows=1, free=TRUE, values=0.8378001, labels=c("anxanx1h")), 
mxPath(from = "L1", to = "Time2anxiety", arrows=1, free=FALSE , values=1, labels=c("L1T2anx")), 
mxPath(from = "L2", to = "Time4anxiety", arrows=1, free=FALSE , values=1, labels=c("L2T4anx")), 
mxPath(from = "L1", to = "L2", arrows=1, free=FALSE , values=1, labels=c("L1L2")), 
mxPath(from = "changeanxiety", to = "L2", arrows=1, free=FALSE , values=1, labels=c("changeanxT4L2")), 
mxPath(from ="L1", to = "changeanxiety", arrows = 2, free=TRUE, values = -.9, labels=c("L1changeanx")), 
mxPath(from = "L1", to = "L1", arrows = 2, free=FALSE, values = 1, labels=c("L1var")), 
mxPath(from = "Time2anxiety", to = "Time2anxiety", arrows = 2, free=FALSE, values = 1, labels=c("T2anxvar")), 
mxPath(from = "Time4anxiety", to = "Time4anxiety", arrows = 2, free=FALSE, values = 1, labels=c("T4anxvar")), 
mxPath(from = "changeanxiety", to = "changeanxiety", arrows = 2, free=TRUE, values = 100, labels=c("changeanxvar")), 
mxPath(from = "Time2anxiety_1a", to = "Time2anxiety_1a", arrows = 2, free=TRUE, values = 0.5647315, labels=c("anx1avar")), 
mxPath(from = "Time2anxiety_1b", to = "Time2anxiety_1b", arrows = 2, free=TRUE, values = 0.3528205, labels=c("T2anx1bvar")), 
mxPath(from = "Time2anxiety_1f", to = "Time2anxiety_1f", arrows = 2, free=TRUE, values = 0.5079372, labels=c("anx1fvar")), 
mxPath(from = "Time2anxiety_1h", to = "Time2anxiety_1h", arrows = 2, free=TRUE, values = 0.5221816, labels=c("anx1hvar")), 
mxPath(from = "Time4anxiety_1a", to = "Time4anxiety_1a", arrows = 2, free=TRUE, values = 0.5647315, labels=c("anx1avar")), 
mxPath(from = "Time4anxiety_1b", to = "Time4anxiety_1b", arrows = 2, free=TRUE, values = 0.2175539, labels=c("T4anx1bvar")), 
mxPath(from = "Time4anxiety_1f", to = "Time4anxiety_1f", arrows = 2, free=TRUE, values = 0.5079372, labels=c("anx1fvar")), 
mxPath(from = "Time4anxiety_1h", to = "Time4anxiety_1h", arrows = 2, free=TRUE, values = 0.5221816, labels=c("anx1hvar")), 
mxPath(from = "one", to = "changeanxiety", arrows=1, free=TRUE, values = -1.5, labels=c("mchangeanx")), 
mxPath(from = "one", to = "Time4anxiety", arrows=1, free=FALSE, values = 0, labels=c("mT4anx")), 
mxPath(from = "one", to = "Time2anxiety", arrows=1, free=FALSE, values = 0, labels=c("mT2anx")), 
mxPath(from = "one", to = "L1", arrows=1, free=FALSE, values = 0, labels=c("mL1")), 
mxPath(from = "one", to = "Time2anxiety_1a", arrows=1, free=TRUE, values = 2.29, labels=c("mT2anx1a")), 
mxPath(from = "one", to = "Time2anxiety_1b", arrows=1, free=TRUE, values = 1.68, labels=c("mT2anx1b")), 
mxPath(from = "one", to = "Time2anxiety_1f", arrows=1, free=TRUE, values = 1.85, labels=c("mT2anx1f")), 
mxPath(from = "one", to = "Time2anxiety_1h", arrows=1, free=TRUE, values = 1.68, labels=c("mT2anx1h")), 
mxPath(from = "one", to = "Time4anxiety_1a", arrows=1, free=TRUE, values = 2.22, labels=c("mT4anx1a")), 
mxPath(from = "one", to = "Time4anxiety_1b", arrows=1, free=TRUE, values = 1.60, labels=c("mT4anx1b")), 
mxPath(from = "one", to = "Time4anxiety_1f", arrows=1, free=TRUE, values = 1.81, labels=c("mT4anx1f")), 
mxPath(from = "one", to = "Time4anxiety_1h", arrows=1, free=TRUE, values = 1.65, labels=c("mT4anx1h")), 
mxData(observed=mydata8, type="raw"))
 
 
Finalmodelanxietystep2Run <-mxTryHard(Finalmodelanxietystep2)
refMods<-mxRefModels(Finalmodelanxietystep2Run, run = T)
summary(Finalmodelanxietystep2Run, refModels=refMods)

No matter what I used as starting points for the variance in change in anxiety and the covariance of L1 and change in anxiety, it always came up as the same negative number, -.69.

Then, I thought that maybe I should also add in the covariance between T2 anxiety and T4 anxiety, like this (only added piece is the T2anxT4anx parameter):

Finalmodelanxietystep2<-mxModel(model="finalmodelanxietystep2", type="RAM", manifestVars=manifests, latentVars=latents, 
mxPath(from="Time2anxiety", to="Time2anxiety_1a", arrows=1, free=TRUE, values=0.8476268, labels=c("anxanx1a")), 
mxPath(from="Time2anxiety", to="Time2anxiety_1b", arrows=1, free=TRUE, values=0.8577030, labels=c("anxanx1b")), 
mxPath(from="Time2anxiety", to="Time2anxiety_1f", arrows=1, free=TRUE, values=0.8541549, labels=c("anxanx1f")), 
mxPath(from="Time2anxiety", to="Time2anxiety_1h", arrows=1, free=TRUE, values=0.8378001, labels=c("anxanx1h")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1a", arrows=1, free=TRUE, values=0.8476268, labels=c("anxanx1a")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1b", arrows=1, free=TRUE, values=0.8577030, labels=c("anxanx1b")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1f", arrows=1, free=TRUE, values=0.8541549, labels=c("anxanx1f")), 
mxPath(from="Time4anxiety", to="Time4anxiety_1h", arrows=1, free=TRUE, values=0.8378001, labels=c("anxanx1h")), 
mxPath(from = "L1", to = "Time2anxiety", arrows=1, free=FALSE , values=1, labels=c("L1T2anx")), 
mxPath(from = "L2", to = "Time4anxiety", arrows=1, free=FALSE , values=1, labels=c("L2T4anx")), 
mxPath(from = "L1", to = "L2", arrows=1, free=FALSE , values=1, labels=c("L1L2")), 
mxPath(from = "changeanxiety", to = "L2", arrows=1, free=FALSE , values=1, labels=c("changeanxT4L2")), 
mxPath(from ="L1", to = "changeanxiety", arrows = 2, free=TRUE, values = -.9, labels=c("L1changeanx")), 
mxPath(from ="Time2anxiety", to = "Time4anxiety", arrows = 2, free=TRUE, values = .67, labels=c("T2anxT4anx")), 
mxPath(from = "L1", to = "L1", arrows = 2, free=FALSE, values = 1, labels=c("L1var")), 
mxPath(from = "Time2anxiety", to = "Time2anxiety", arrows = 2, free=FALSE, values = 1, labels=c("T2anxvar")), 
mxPath(from = "Time4anxiety", to = "Time4anxiety", arrows = 2, free=FALSE, values = 1, labels=c("T4anxvar")), 
mxPath(from = "changeanxiety", to = "changeanxiety", arrows = 2, free=TRUE, values = 100, labels=c("changeanxvar")), 
mxPath(from = "Time2anxiety_1a", to = "Time2anxiety_1a", arrows = 2, free=TRUE, values = 0.5647315, labels=c("anx1avar")), 
mxPath(from = "Time2anxiety_1b", to = "Time2anxiety_1b", arrows = 2, free=TRUE, values = 0.3528205, labels=c("T2anx1bvar")), 
mxPath(from = "Time2anxiety_1f", to = "Time2anxiety_1f", arrows = 2, free=TRUE, values = 0.5079372, labels=c("anx1fvar")), 
mxPath(from = "Time2anxiety_1h", to = "Time2anxiety_1h", arrows = 2, free=TRUE, values = 0.5221816, labels=c("anx1hvar")), 
mxPath(from = "Time4anxiety_1a", to = "Time4anxiety_1a", arrows = 2, free=TRUE, values = 0.5647315, labels=c("anx1avar")), 
mxPath(from = "Time4anxiety_1b", to = "Time4anxiety_1b", arrows = 2, free=TRUE, values = 0.2175539, labels=c("T4anx1bvar")), 
mxPath(from = "Time4anxiety_1f", to = "Time4anxiety_1f", arrows = 2, free=TRUE, values = 0.5079372, labels=c("anx1fvar")), 
mxPath(from = "Time4anxiety_1h", to = "Time4anxiety_1h", arrows = 2, free=TRUE, values = 0.5221816, labels=c("anx1hvar")), 
mxPath(from = "one", to = "changeanxiety", arrows=1, free=TRUE, values = -1.5, labels=c("mchangeanx")), 
mxPath(from = "one", to = "Time4anxiety", arrows=1, free=FALSE, values = 0, labels=c("mT4anx")), 
mxPath(from = "one", to = "Time2anxiety", arrows=1, free=FALSE, values = 0, labels=c("mT2anx")), 
mxPath(from = "one", to = "L1", arrows=1, free=FALSE, values = 0, labels=c("mL1")), 
mxPath(from = "one", to = "Time2anxiety_1a", arrows=1, free=TRUE, values = 2.29, labels=c("mT2anx1a")), 
mxPath(from = "one", to = "Time2anxiety_1b", arrows=1, free=TRUE, values = 1.68, labels=c("mT2anx1b")), 
mxPath(from = "one", to = "Time2anxiety_1f", arrows=1, free=TRUE, values = 1.85, labels=c("mT2anx1f")), 
mxPath(from = "one", to = "Time2anxiety_1h", arrows=1, free=TRUE, values = 1.68, labels=c("mT2anx1h")), 
mxPath(from = "one", to = "Time4anxiety_1a", arrows=1, free=TRUE, values = 2.22, labels=c("mT4anx1a")), 
mxPath(from = "one", to = "Time4anxiety_1b", arrows=1, free=TRUE, values = 1.60, labels=c("mT4anx1b")), 
mxPath(from = "one", to = "Time4anxiety_1f", arrows=1, free=TRUE, values = 1.81, labels=c("mT4anx1f")), 
mxPath(from = "one", to = "Time4anxiety_1h", arrows=1, free=TRUE, values = 1.65, labels=c("mT4anx1h")), 
mxData(observed=mydata8, type="raw"))
 
 
Finalmodelanxietystep2Run <-mxTryHard(Finalmodelanxietystep2)
refMods<-mxRefModels(Finalmodelanxietystep2Run, run = T)
summary(Finalmodelanxietystep2Run, refModels=refMods)

This ran without negative variances, but the variance of change in anxiety is huge, like 66, and the covariance of L1 and change in anxiety is super negative, -33. This seems maybe a bit off?

Any help would be greatly appreciated! Thank you!

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
variance decomposition; model identification
No matter what I used as starting points for the variance in change in anxiety and the covariance of L1 and change in anxiety, it always came up as the same negative number, -.69.

Are you sure 'L2' and 'Time4anxiety' are supposed to have double-headed paths going to themselves? That is, should 'L2' and 'Time4anxiety' have nonzero "residual" variance? I would have thought that the idea behind this model is that all variance in 'L2' (and thus, all variance in 'Time4anxiety') is entirely due to the regression of 'L2' onto 'L1' and 'changeanxiety'. What happens if you fix those double-headed paths to zero?

This ran without negative variances, but the variance of change in anxiety is huge, like 66, and the covariance of L1 and change in anxiety is super negative, -33. This seems maybe a bit off?

That screams model unidentification to me, especially if you're not using NPSOL. What does mxCheckIdentification() tell you?