Bivariate dual change core model - fits in Mplus but not in lavaan (ERROR: initial model-implied matrix (Sigma) is not positive definite; check your model and/or starting parameters)

33 views
Skip to first unread message

Caroline Wehner

unread,
Jun 15, 2020, 10:49:11 AM6/15/20
to lavaan
Hi everyone, 

I am trying to fit a bivariate dual change score model to my data. I get the lavaan ERROR: initial model-implied matrix (Sigma) is not positive definite; check your model and/or starting parameters.
I decided to fit a univariate model first to obtain useful starting values. However, here I got the same error. Then I used Mplus to see whether I might be able to obtain starting values. This indeed works but entering the values to the model I set up in R does not solve the initial problem.

This is the model specification I used in R (with already inserted starting values from the Mplus model):

udcsm_model3 <- '
#define latents
narc1 =~ 1*t1_narq_mean
narc2 =~ 1*t2_narq_mean
narc3 =~ 1*t3_narq_mean
narc4 =~ 1*t4_narq_mean

#define regression of latents
narc2~1*narc1
narc3~1*narc2
narc4~1*narc3

#define latent cs
dn2 =~ 1*narc2
dn3 =~ 1*narc3
dn4 =~ 1*narc4

#define autoproportions
dn2 ~ start(-.78)*pi_n*narc1  
dn3 ~ start(-.78)*pi_n*narc2  
dn4 ~ start(-.78)*pi_n*narc3  

#define level and slope
BL =~ 1*narc1
SL =~ 1*dn2 + 1*dn3 + 1*dn4

#define fake level and slope
BL2 =~ 1*BL
SL2 =~ 1*SL

#means/intercepts
## observed intercepts (fixed to 0)
t1_narq_mean ~ 0*1
t2_narq_mean ~ 0*1
t3_narq_mean ~ 0*1
t4_narq_mean ~ 0*1
##latents
narc1 ~ 0*1 
narc2 ~ 0*1
narc3 ~ 0*1
narc4 ~ 0*1
##cs
dn2 ~ 0*1
dn3 ~ 0*1
dn4 ~ 0*1
##Level and Slope
BL ~ 0*1
SL ~ 0*1
BL2 ~ start(2.52)*1
SL2 ~ start(2.20)*1

#variances
##latents
narc1 ~~ 0*narc1 
narc2 ~~ 0*narc2
narc3 ~~ 0*narc3
narc4 ~~ 0*narc4
##cs
dn2 ~~ 0*dn2
dn3 ~~ 0*dn3
dn4 ~~ 0*dn4
##BL and SL
BL~~0*BL
SL~~0*SL
BL2~~start(.91)*BL2
SL2~~start(.65)*SL2

#correlation among fake factors
BL~~0*SL
BL~~0*SL2
SL~~0*BL2
BL2~~NA*SL2

#setting residuals equal
t1_narq_mean ~~ sigma2_n*10*t1_narq_mean
t2_narq_mean ~~ sigma2_n*10*t1_narq_mean
t3_narq_mean ~~ sigma2_n*10*t1_narq_mean
t4_narq_mean ~~ sigma2_n*10*t1_narq_mean
'

Here the equivalent in Mplus:

MODEL:  
      !define level factors
      narc1  BY t1_narq_mean@1;
      narc2  BY t2_narq_mean@1;
      narc3  BY t3_narq_mean@1;
      narc4  BY t4_narq_mean@1;

      !define regression of level factors
      narc2  ON narc1@1;
      narc3  ON narc2@1;
      narc4  ON narc3@1;

      !define difference scores
      dnarc1  BY narc2@1;  
      dnarc2  BY narc3@1;
      dnarc3  BY narc4@1;
   
      !define auto-proportion
      dnarc1  ON narc1*0 (nauto);
      dnarc2  ON narc2*0 (nauto);
      dnarc3  ON narc3*0 (nauto);

      !define level and linear slope factors
      narcI BY narc1@1;
      narcS BY dnarc1-dnarc3@1;

      !define fake level and slope factors
      narcIa BY narcI@1;
      narcSa BY narcS@1;

      !means
      [t1_narq_mean-t4_narq_mean@0];
      [narc1-narc4@0];
      [dnarc1-dnarc3@0];
      [narcI@0 narcS@0];
      [narcIa* narcSa*];

      !variance
      narc1-narc4@0;
      dnarc1-dnarc3@0;
      narcI@0 narcS@0;
      narcIa*50 narcSa*1;

      !intercorrelation among fake factors
      narcI  WITH narcS@0;
      narcI  WITH narcSa@0;
      narcS  WITH narcIa@0;
      narcIa WITH narcSa*0;

      !specific variance set equal
      t1_narq_mean-t4_narq_mean*10 (spnarc);


This is the correlation matrix of my data:

                  T1_NARQ_      T2_NARQ_      T3_NARQ_      T4_NARQ_
                     ________      ________      ________      ________
 T1_NARQ_       1.000
 T2_NARQ_       0.702         1.000
 T3_NARQ_       0.699         0.778         1.000
 T4_NARQ_       0.657         0.771         0.800         1.000 


I would really appreciate your help or sharing your experiences with similar problems. 
Caroline

Edward Rigdon

unread,
Jun 15, 2020, 11:05:19 AM6/15/20
to lav...@googlegroups.com
Caroline--
     May I suggest that these lines are a problem:

#define autoproportions
dn2 ~ start(-.78)*pi_n*narc1  
dn3 ~ start(-.78)*pi_n*narc2  
dn4 ~ start(-.78)*pi_n*narc3  

I think these lines are a problem because they apply two modifiers ("start(-.78)" and "pi_n") together. Instead, try restating these lines as, for example:

dn2 ~ start(-.78)*narc1 + pi_n*narc1  

Similarly, you have lines in your syntax that feature multiple moderators:

#setting residuals equal
t1_narq_mean ~~ sigma2_n*10*t1_narq_mean
t2_narq_mean ~~ sigma2_n*10*t1_narq_mean
t3_narq_mean ~~ sigma2_n*10*t1_narq_mean
t4_narq_mean ~~ sigma2_n*10*t1_narq_mean

Yes, I would expect the lavaan syntax parser to complain about this, but sometimes it just gets confused. If it wouldn't be too much trouble, try rewriting these lines and see if it makes a difference.

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/2eb6094d-8dcd-402f-9b8d-73cbcf1d45f9o%40googlegroups.com.

Caroline Wehner

unread,
Jun 15, 2020, 11:29:19 AM6/15/20
to lavaan
Thank you for your suggestion, Edward. 

I did change my syntax accordingly but unfortunately it does not change anything.
To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.

Mauricio Garnier-Villarreal

unread,
Jun 15, 2020, 12:15:14 PM6/15/20
to lavaan
Caroline

I found the problem, you had misspecified the residual variances, by

t1_narq_mean ~~ sigma2_n*10*t1_narq_mean
t2_narq_mean ~~ sigma2_n*10*t1_narq_mean
t3_narq_mean ~~ sigma2_n*10*t1_narq_mean
t4_narq_mean ~~ sigma2_n*10*t1_narq_mean

You specified that time had covariances with every other variable, which should have been

t1_narq_mean ~~ sigma2_n*t1_narq_mean
t2_narq_mean ~~ sigma2_n*t2_narq_mean
t3_narq_mean ~~ sigma2_n*t3_narq_mean
t4_narq_mean ~~ sigma2_n*t4_narq_mean

I assume you copy and paste the section and missed to change the variable name for the right side of the covariances, simple fix. This worked for me when I corrected it


Caroline Wehner

unread,
Jun 15, 2020, 12:26:39 PM6/15/20
to lavaan
You were right. Thank you so much and sorry for taking your time with this silly error!

Mauricio Garnier-Villarreal

unread,
Jun 15, 2020, 8:27:13 PM6/15/20
to lavaan

No problem, good it was an easy fix
Reply all
Reply to author
Forward
0 new messages