Growth curve model with imputed data (mice)

91 views
Skip to first unread message

Matti Cervin

unread,
Apr 5, 2019, 4:10:59 AM4/5/19
to lavaan
I want to estimate a Growth Curve Model in a dataset with four waves of data collection across six variables. I also want to see if group affects the slopes. However, I am having problems with getting the mice imputations to work with lavaan. All variables are ordered so I cannot handle missing data directly with fiml in lavaan (however, when I try without including group and treating the data as continuous, everything seem to work fine). This is the code:

sem <- read.csv("~/Dropbox/Artiklar/CAMS/data/semcbt.csv", sep=";")
mi<-sem[1:25]

#### Multiple imputation

### Test model to set final model
initial1<-mice(mi, maxit=0, print=F)
initial1$method #PMM - good
initial1$predictorMatrix #Looks ok

### Now we run the imputation
imp_df<-mice(mi, m=5, maxit=10, seed=1234, meth=initial1$method, 
             pred=initial1$predictorMatrix)

#Make a list of the imputations
milist <- miceadds::mids2datlist(imp_df)

Up until now everything seem to work fine.

### Growth Curve Model

#First fit indices
order<-c("df", "chisq", "cfi", "tli", "rmsea", "srmr")

growthmodelcams<-'
ifreq =~ 1*freq1 + 1*freq2 + 1*freq3 + 1*freq4
ipsy =~ 1*psy1 + 1*psy2 + 1*psy3 + 1*psy4
iphys =~ 1*phys1 + 1*phys2 + 1*phys3 + 1*phys4
iavo =~ 1*avo1 + 1*avo2 + 1*avo3 + 1*avo4
ifam =~ 1*fam1 + 1*fam2 + 1*fam3 + 1*fam4
ipeer =~ 1*peer1 + 1*peer2 + 1*peer3 + 1*peer4

sfreq =~ 0*freq1 + 1*freq2 + 2*freq3 + 3*freq4
spsy =~ 0*psy1 + 1*psy2 + 2*psy3 + 3*psy4
sphys =~ 0*phys1 + 1*phys2 + 2*phys3 + 3*phys4
savo =~ 0*avo1 + 1*avo2 + 2*avo3 + 3*avo4
sfam =~ 0*fam1 + 1*fam2 + 2*fam3 + 3*fam4
speer =~ 0*peer1 + 1*peer2 + 2*peer3 + 3*peer4

sfreq ~ cbt_plac
spsy ~ cbt_plac
sphys ~ cbt_plac
savo ~ cbt_plac
sfam ~ cbt_plac
speer ~ cbt_plac
'

fit7<-runMI(growthmodelcams, milist, estimator="WLSMV", fun="growth", ordered=c("freq1", "freq2", "freq3", "freq4",
                                            "psy1", "psy2", "psy3", "psy4",
                                            "phys1", "phys2", "phys3", "phys4",
                                            "avo1", "avo2", "avo3", "avo4",
                                            "fam1", "fam2", "fam3", "fam4",
                                            "peer1", "peer2", "peer3", "peer4"))

Lavaan runs for a while and then this error messages occurs:

There were 50 or more warnings (use warnings() to see the first 50)

warnings()

Warning messages:
1: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.
2: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING: could not invert information matrix

3: In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
4: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.
5: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING: could not invert information matrix

6: In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
7: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfreq spsy
8: In sqrt(var.lhs.value * var.rhs.value) : NaNs produced
9: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply NaN for a correlation value;
                  variables involved are: sfreq sphys
10: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy savo
11: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy sfam
12: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy speer
13: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo sfam
14: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo speer
15: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfam speer
16: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.
17: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING: could not invert information matrix

18: In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
19: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfreq spsy
20: In sqrt(var.lhs.value * var.rhs.value) : NaNs produced
21: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply NaN for a correlation value;
                  variables involved are: sfreq sphys
22: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy savo
23: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy sfam
24: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy speer
25: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo sfam
26: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo speer
27: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfam speer
28: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.
29: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING: could not invert information matrix

30: In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
31: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfreq spsy
32: In sqrt(var.lhs.value * var.rhs.value) : NaNs produced
33: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply NaN for a correlation value;
                  variables involved are: sfreq sphys
34: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy savo
35: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy sfam
36: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy speer
37: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo sfam
38: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo speer
39: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfam speer
40: In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING:
    Could not compute standard errors! The information matrix could
    not be inverted. This may be a symptom that the model is not
    identified.
41: In lav_test_satorra_bentler(lavobject = NULL, lavsamplestats = lavsamplestats,  ... :
  lavaan WARNING: could not invert information matrix

42: In lav_object_post_check(object) :
  lavaan WARNING: some estimated lv variances are negative
43: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: sfreq spsy
44: In sqrt(var.lhs.value * var.rhs.value) : NaNs produced
45: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply NaN for a correlation value;
                  variables involved are: sfreq sphys
46: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy savo
47: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy sfam
48: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: spsy speer
49: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo sfam
50: In lav_start_check_cov(lavpartable = lavpartable, start = START) :
  lavaan WARNING: starting values imply a correlation larger than 1;
                  variables involved are: savo speer

Any suggestions of what could be the problem?

Terrence Jorgensen

unread,
Apr 5, 2019, 5:43:48 AM4/5/19
to lavaan
Any suggestions of what could be the problem?

Your model is not identified because the indicators are ordinal.  By default, their mean structure is assumed zero, allowing thresholds to be estimated, so there is no growth to model (intercepts are fixed to zero for identification).  Read this:


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

Message has been deleted
Message has been deleted

Matti Cervin

unread,
Apr 5, 2019, 6:15:49 AM4/5/19
to lav...@googlegroups.com
Thank you Terrence. I will read that paper. If I understand it correctly, it is possible to fit a model like this in lavaan, i.e. a growth curve model with ordinal indicators. Do you know if there is code anywhere that shows you have to do it? (I am quite new to lavaan.)

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/vEwgKEo-IBw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

Terrence Jorgensen

unread,
Apr 6, 2019, 4:22:36 PM4/6/19
to lavaan
Do you know if there is code anywhere that shows you have to do it? 

The ?model.syntax help page describes all the operators you need.  With a little extrapolation from the examples, you can just follow the instructions described in the article.

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam
Reply all
Reply to author
Forward
0 new messages