Dear Professors,
I am doing a mediation analysis within latent growth curve model, and I continuouly got one error message and don't know how to deal with it. Briefly, I introduce my analyses and database first. My analyses is to look at how variable "m" relate to a distal outcome, whether there exist direct effect or indirect effect mediated by variable "r". My study is a longitudinal design, therefore, variable "m" and variable "r" were measured repeatly at 5 time points. In addition, there are several time-invariant covariates, such as sex, and the distal outcome is a binary variable, coded as 0 for no outcome and 1 for having the outcome. The data has cluster structure ("PAID" variable is standing for the cluster), and also has missing values.
Below is my lavaan code and the path of my hypotheses:
model.mediation='
# random intercepts and slopes for variables "m" and "r"
m.i=~1*m1+1*m2+1*m3+1*m4+1*m5
m.s=~0*m1+1*m2+2*m3+3*m4+4*m5
r.i=~1*r1+1*r2+1*r3+1*r4+1*r5
r.s=~0*r1+1*r2+2*r3+3*r4+4*r5
# covariance and variance of latent intercepts and slopes
m.i~~m.i
m.s~~m.s
m.i~~m.s
r.i~~r.i
r.s~~r.s
r.i~~r.s
# create structured residuals
m1~~covm*m1
m2~~covm*m2
m3~~covm*m3
m4~~covm*m4
m5~~covm*m5
r1~~covr*r1
r2~~covr*r2
r3~~covr*r3
r4~~covr*r4
r5~~covr*r5
# direct effect
outcome~x1*m.i+x2*m.s+sex # red lines
# mediator effect
r.i~x3*m.i+sex # purple lines
r.s~x5*m.i+x6*m.s+sex # purple lines
outcome~m1*r.i+m2*r.s # blue lines
# indirect effect
miri:=x3*m1
mirs:=x5*m2
ms:=x6*m2
sum_mi:=x3*m1+x5*m2
# total effect:
total.mi:=x1+x3*m1+x5*m2
total.ms:=x2+x6*m2
'
fit.model=growth(model = model.mediation, data = pheno, cluster = "PAIR", ordered = "outcome", estimator='WLSMV', link = "probit", missing="pairwise")
The message I got after fitting this model is:
Error in th.start.idx[i]:th.end.idx[i] : NA/NaN argument
In addition: Warning messages:
1: In lav_options_set(opt) :
lavaan WARNING: information will be set to “expected” for estimator = “DWLS”
2: In lav_data_full(data = data, group = group, cluster = cluster, :
lavaan WARNING: due to missing values, some pairwise combinations have less than 10% coverage
Here are my questions:
1. What does this error message mean? is it because of the missing values? How to deal with the error message? (Also I have no idea the error message is due to the update of the lavaan package. Just before the updating, I could got fitted results.)
2. Am I correct to use "growth" function when fitting the model? If I would like to use the general lavaan function, what arguments should I consider in this model? Actually I have tried both functions in the same data before, and it seemed that they got different estimations of the parameters.
3. To fit a pure growth curve model, where I mean no "outcome" and no mediation analysis, I ask the latent intercept and slope to regress on covariates, for example m.i~1+sex, m.s~1+sex, r.i~1+sex, r.s~1+sex, but in this combined model (combine latent growth curve and mediation analyses), I only regress r.i and r.s regress on covariate, is it correct?
Thank you very much.
Regards
Xueying