Multitrait-multistate model: negative variances

32 views
Skip to first unread message

Simon Columbus

unread,
Feb 1, 2017, 9:12:18 AM2/1/17
to lavaan
Hi all,

I am trying to specify a multitrait-multistate model (two states, six item-specific traits) in lavaan; I've attached a diagram for illustration. Unfortunately, I am running into problems with negative ov and lv variances (i.e., warning messages "some estimated ov/lv variances are negative"), which I have not been able to resolve. The model looks as follows (I've included code to simulate a data set. This does not always yield usable data; I have attached a data frame that yields the relevant error):


# GENERATE DATA

df
.i <- as.data.frame(matrix(NA,3000,12))
t
<- rep(rnorm(6, 0, 1),times=2)
s
<- rep(rnorm(2, 0, 1),times=6)
for (i in 1:12){
  df
.i[,i] <- rnorm(3000,0,1)+t[i]+s[i]
}


names
(df.i) <- paste("y", rep(1:6, times=2), rep(1:2, each=6), sep="")


# MODEL


model
.sis <- '
# latent variables
## latent states
s1 =~ 1*y11 + la211*y21 + la311*y31 + la411*y41 + la511*y51 + la611*y61
s2 =~ 1*y12 + la221*y22 + la321*y32 + la421*y42 + la521*y52 + la621*y62


## latent traits
t1 =~ 1*y11 + la122*y12
t2 =~ 1*y21 + la222*y22
t3 =~ 1*y31 + la322*y32
t4 =~ 1*y41 + la422*y42
t5 =~ 1*y51 + la522*y52
t6 =~ 1*y61 + la622*y62


# (co)variances
## variances of states s
s1 ~~ vars1*s1
s2 ~~ vars2*s2


## variances of traits t
t1 ~~ vart1*t1
t2 ~~ vart2*t2
t3 ~~ vart3*t3
t4 ~~ vart4*t4
t5 ~~ vart5*t5
t6 ~~ vart6*t6


## variances of indicators
y11 ~~ vary11*y11
y21 ~~ vary21*y21
y31 ~~ vary31*y31
y41 ~~ vary41*y41
y51 ~~ vary51*y51
y61 ~~ vary61*y61
y12 ~~ vary12*y12
y22 ~~ vary22*y22
y32 ~~ vary32*y32
y42 ~~ vary42*y42
y52 ~~ vary52*y52
y62 ~~ vary62*y62


## covariances
s1 + s2 ~~ 0*t1 + 0*t2 + 0*t3 + 0*t4 + 0*t5 + 0*t6 # covariances of states and traits set to 0
s1 ~~ 0*s2 # covariances of states set to 0
t1 ~~ cov12*t2 + cov13*t3 + cov14*t4 + cov15*t5 + cov16*t6
t2 ~~ cov23*t3 + cov24*t4 + cov25*t5 + cov26*t6
t3 ~~ cov34*t4 + cov35*t5 + cov36*t6
t4 ~~ cov45*t5 + cov46*t6
t5 ~~ cov56*t6


# invariances


vars1 == vars2
'


# FIT CFA

fit
<- cfa(model.sis, data=df.i)

I have tried to resolve this problem by specifying additional invariances between the factor loadings for the latent trait factors:

la211 == la221
la311
== la321
la411
== la421
la511
== la521
la611
== la621

However, this does not resolve the issue. At the moment, I am puzzled as to why the CFA leads to negative variances; so I'd appreciate any pointers.

Kind regards,
Simon

output.pdf
Simulated_MTMS_Data.Rdata

Terrence Jorgensen

unread,
Feb 3, 2017, 10:07:16 AM2/3/17
to lavaan
Doesn't sound like lavaan is the problem.  Perhaps you could post you question on SEMNET to see if anyone can offer advice.


Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
0 new messages