Longitudinal Multi-group latent growth curve model with time-variant and time-invariant predictors

1,465 views
Skip to first unread message

Harry Adraktas-Rentis

unread,
Mar 24, 2015, 10:52:47 AM3/24/15
to lav...@googlegroups.com
Hi all,

First of all, I am relatively new in using R and haven't used lavaan (or growth models) before so please excuse my ignorance.

I am doing my thesis and analyzing the U.S. financial industry during the financial crisis of 2007. I therefore have individual banks and several variables for each bank across time (from 2007-2013), some are time-variant (such as ROA or capital adequacy) and some are time-invariant (such as size or age). Some variables are also time-variant but not multi-level since they apply to all firms (such as the average ROA of the U.S. financial industry).

Fist of all, can I use lavaan's growth curve model ("growth") in this instance? The example given on the tutorial is for either time-varying variables (c) that influence the outcome (DV) or time-invariant variables (x1 & x2) which influence the slope (s) and intercept (i). What about time varying variables that influence the slope and intercept? I couldn't find an example for this syntax.

Also, how do I specify the "groups" (i.e. different banks) in my analysis? It is actually possible to do a multi-level growth curve model in lavaan (or R for that matter)?

Last but not least, I could find how to import a multilevel dataset in R. My dataset is basically a 3-dimentional matrix (different variables for different firms across time) so how do I input that via SPSS (or notepad?)?

Any help is much appreciated, I am basically lost on how to implement this model and sincerely need some assistance...

Thank you all in advance for your time!

Harry

yrosseel

unread,
Mar 25, 2015, 3:48:53 AM3/25/15
to lav...@googlegroups.com
On 03/24/2015 03:52 PM, Harry Adraktas-Rentis wrote:
> Hi all,
>
> First of all, I am relatively new in using R and haven't used lavaan (or
> growth models) before so please excuse my ignorance.
>
> I am doing my thesis and analyzing the U.S. financial industry during
> the financial crisis of 2007. I therefore have individual banks and
> several variables for each bank across time (from 2007-2013)

This is the crucial part: do you have the same number of time points for
each bank? If yes, then you can use lavaan. If not, you have unbalanced
data, and you need to use mixed models.

> Fist of all, can I use lavaan's growth curve model ("growth") in this
> instance? The example given on the tutorial is for either time-varying
> variables (c) that influence the outcome (DV) or time-invariant
> variables (x1 & x2) which influence the slope (s) and intercept (i).
> What about time varying variables that influence the slope and
> intercept? I couldn't find an example for this syntax.

You can combine those, no problem.

> Also, how do I specify the "groups" (i.e. different banks) in my
> analysis? It is actually possible to do a multi-level growth curve model
> in lavaan (or R for that matter)?

You may have to reshape your data so that they are in 'wide' format:
each row is a single bank (and the repeated measures are multiple columns).

> Last but not least, I could find how to import a multilevel dataset in
> R. My dataset is basically a 3-dimentional matrix (different variables
> for different firms across time) so how do I input that via SPSS (or
> notepad?)?

You should read in the matrix/data in R, and 'reshape' your data until
it is a 2D data.frame, with a single row per bank. But that is a
question for another forum...

Yves.

Harry Adraktas-Rentis

unread,
Mar 25, 2015, 7:29:12 AM3/25/15
to lav...@googlegroups.com
Hi Yves,

First of all thank you for your response and your assistance, it was very helpful and reassuring.

On Wednesday, March 25, 2015 at 9:48:53 AM UTC+2, yrosseel wrote:

This is the crucial part: do you have the same number of time points for
each bank? If yes, then you can use lavaan. If not, you have unbalanced
data, and you need to use mixed models.

Yes, I generally have the same number of points for each bank. There is just one datapoint for one variable of one bank missing, is it possible to fill-in the missing value with an estimate with lavaan?

> Fist of all, can I use lavaan's growth curve model ("growth") in this
> instance? The example given on the tutorial is for either time-varying
> variables (c) that influence the outcome (DV) or time-invariant
> variables (x1 & x2) which influence the slope (s) and intercept (i).
> What about time varying variables that influence the slope and
> intercept? I couldn't find an example for this syntax.

You can combine those, no problem.

How would the syntax look like in this case though? The example given in the tutorial is something like this:

# regressions
i ~ x1 + x2
s ~ x1 + x2
# time-varying covariates
t1 ~ c1
t2 ~ c2
t3 ~ c3
t4 ~ c4 

If I have regressors that are also time-varying do I have to "split them up" and create one predictor for each variable and each time-step? (for example firm_size_2007, firm_size_2008, etc.) and regress all of them on the intercept and slope?

e.g. t1 ~ size_2007 + cap_adeq_2007...
      t2 ~ size_2008 + cap_adeq_2008...
      ...

      i ~ size_2007 + size_2008 + ... + cap_adeq_2007 + cap_adeq_2008 + ... + ...
     ...

> Also, how do I specify the "groups" (i.e. different banks) in my
> analysis? It is actually possible to do a multi-level growth curve model
> in lavaan (or R for that matter)?

You may have to reshape your data so that they are in 'wide' format:
each row is a single bank (and the repeated measures are multiple columns).

So basically reshape my data the same way I mentioned above (expand each time-varying variable into a different variable for each year)? But then my dependent variable (ROA in my case) will not be one variable but several (ROA_2007, ROA_2008, ROA_2009, and so on) and then specify "bank name" as the grouping variable? Would that actually work?

> Last but not least, I could find how to import a multilevel dataset in
> R. My dataset is basically a 3-dimentional matrix (different variables
> for different firms across time) so how do I input that via SPSS (or
> notepad?)?

You should read in the matrix/data in R, and 'reshape' your data until
it is a 2D data.frame, with a single row per bank. But that is a
question for another forum...

This is, again, the same process as above. 

Yves.

I apologize for my profound ignorance, but I am a student and don't know where else to turn to figure these things out. Thank you in advance if you take the time to respond again.

Harry 

yrosseel

unread,
Mar 26, 2015, 3:39:18 AM3/26/15
to lav...@googlegroups.com
On 03/25/2015 12:29 PM, Harry Adraktas-Rentis wrote:
> Yes, I generally have the same number of points for each bank. There is
> just one datapoint for one variable of one bank missing, is it possible
> to fill-in the missing value with an estimate with lavaan?

Yes. Use missing="fiml".

> If I have regressors that are also time-varying do I have to "split them
> up" and create one predictor for each variable and each time-step?

Yes. They would become additional columns in your data.frame.

> So basically reshape my data the same way I mentioned above (expand each
> time-varying variable into a different variable for each year)? But then
> my dependent variable (ROA in my case) will not be one variable but
> several (ROA_2007, ROA_2008, ROA_2009, and so on)

Yes. Think of it as a multivariate response vector.

> name" as the grouping variable? Would that actually work?

One row, one bank.

> I apologize for my profound ignorance, but I am a student and don't know
> where else to turn to figure these things out.

One last bit of advice: start with simple models, and let them grow as
your understanding of your model grows.

Yves.

Harry Adraktas-Rentis

unread,
Mar 26, 2015, 7:14:18 AM3/26/15
to lav...@googlegroups.com
Hi Yves,

Thank you sincerely for your assistance, I deeply appreciate it and it has been immensely helpful.

I have restructured my data and attempted to write how the syntax might look like. Do I have to enter the missing data command (missing="fiml") at the beginning, before the model but after I have attached the data?


# import data
inputdata = read.table("inputdata.txt")  # read text file 

# fill in missing data
missing = "fiml"

ETHthesismodel <- '
# intercept and slope with fixed coefficients
i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4

#regressions (independent variables that influence the slope & intercept)
 i ~ high_constr_2007 + high_constr_2008 + ... + low_constr_2007 + low_constr_2008 + ... + ... diff_2013
 s ~ high_constr_2007 + high_constr_2008 + ... + low_constr_2007 + low_constr_2008 + ... + ... diff_2013

# time-varying covariates (control variables)
t1 ~ size_2007 + cap_adeq_2007 + brand_2007 +... + acquisitions_2007
t2 ~ size_2008 + cap_adeq_2008 + brand_2008 + ... + acquisitions_2008
...
t7 ~ size_2013 + cap_adeq_2013 + brand_2013 + ... + acquisitions_2013
'
fit <- growth(ETHthesismodel, data = inputdata,
group = "bank")
summary(fit)

Don't feel obliged to offer any feedback on the code, I just sent it for the sake of completeness.

Thank you for your advice too, believe me it was not my intention to come up with such a complex model. I am familiar with multivariate methods, but mostly with SPSS and the logit/probit model was as far as the course material went, so I had not dealt with growth curve models (or longitudinal models for that matter) before. But my professor and my research pushed me towards that direction in order to find a knowledge gap so I had little room to maneuver tbh. I learnt my lesson though.

Thank you again for taking the time to respond and for your assistance so far, I am really grateful.

Harry



--
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/uZgXzgBoEKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

yrosseel

unread,
Mar 30, 2015, 2:42:28 AM3/30/15
to lav...@googlegroups.com
On 03/26/2015 12:14 PM, Harry Adraktas-Rentis wrote:
> I have restructured my data and attempted to write how the syntax might
> look like. Do I have to enter the missing data command (missing="fiml")
> at the beginning, before the model but after I have attached the data?

It is an argument of the fitting function, as in

fit <- growth(ETHthesismodel, data = inputdata, missing = "fiml")

> ETHthesismodel <- '
> # intercept and slope with fixed coefficients
> i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4
> s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4

Ok, this is for 4 time points.

> #regressions (independent variables that influence the slope & intercept)
> i ~ high_constr_2007 + high_constr_2008 + ... + low_constr_2007 +
> low_constr_2008 + ... + ... diff_2013
> s ~ high_constr_2007 + high_constr_2008 + ... + low_constr_2007 +
> low_constr_2008 + ... + ... diff_2013

Looks good.

> # time-varying covariates (control variables)
> t1 ~ size_2007 + cap_adeq_2007 + brand_2007 +... + acquisitions_2007
> t2 ~ size_2008 + cap_adeq_2008 + brand_2008 + ... + acquisitions_2008
> ...
> t7 ~ size_2013 + cap_adeq_2013 + brand_2013 + ... + acquisitions_2013

But here you have 7 time points?

> fit <- growth(ETHthesismodel, data = inputdata,
> group = "bank")

Why do you need a group variable. If each bank is a single line, the
banks are the (independent) observations. Try

fit <- growth(ETHthesismodel, data = inputdata, missing = "fiml")

Yves.

Harry Adraktas-Rentis

unread,
Mar 30, 2015, 5:48:34 AM3/30/15
to lav...@googlegroups.com
Hi Yves,

Very valid points. Regarding the number of the time points, it was just a test syntax (I have 7 time points, I just kept the syntax from the tutorial there which needs to be modified of course).

Thank you again so much for your input. I plan on implementing certain modifications to the syntax (to make a parallel growth model) which I will post again here. I deeply appreciate your assistance with this and hope I won't take much more of your time.

Best,
Harry



Yves.

Harry Adraktas-Rentis

unread,
Mar 30, 2015, 11:35:16 AM3/30/15
to lav...@googlegroups.com
Please find my most recent attempt on the model syntax. Basically, I am trying to test if there is a link between the growth curves of the IVs with the growth curve of the DV (ROA). I also have some time-varying control variables that I regress directly on the values of the DV.

Finally, there are some time-invariant control variables that are assumed to affect the DV (ROA). Is it valid to add these variables on every time-step (every ROAi variable) in order to control for their influence?

Any input would be greatly appreciated, thank you immensely for your assistance so far. Please find the sytax below:

ETHthesismodel <- '
# intercept and slope with fixed coefficients (time-varying variables - DV & IVs)
i.ROA =~ 1*ROA_2007 + 1*ROA_2008 + 1*ROA_2009 + 1*ROA_2010 + 1*ROA_2011 + 1*ROA_2012 + 1*ROA_2013
s.ROA =~ 0*ROA_2007 + 1*ROA_2008 + 2*ROA_2009 + 3*ROA_2010 + 4*ROA_2011 + 5*ROA_2012 + 6*ROA_2013
i.hc =~ 1*hc_2007 + 1*hc_2008 + 1*hc_2009 + 1*hc_2010 + 1*hc_2011 + 1*hc_2012 + 1*hc_2013
s.hc =~ 0*hc_2007 + 1*hc_2008 + 2*hc_2009 + 3*hc_2010 + 4*hc_2011 + 5*hc_2012 + 6*hc_2013
i.lc =~ 1*lc_2007 + 1*lc_2008 + 1*lc_2009 + 1*lc_2010 + 1*lc_2011 + 1*lc_2012 + 1*lc_2013
s.lc =~ 0*lc_2007 + 1*lc_2008 + 2*lc_2009 + 3*lc_2010 + 4*lc_2011 + 5*lc_2012 + 6*lc_2013
i.pf =~ 1*pf_2007 + 1*pf_2008 + 1*pf_2009 + 1*pf_2010 + 1*pf_2011 + 1*pf_2012 + 1*pf_2013
s.pf =~ 0*pf_2007 + 1*pf_2008 + 2*pf_2009 + 3*pf_2010 + 4*pf_2011 + 5*pf_2012 + 6*pf_2013
i.p =~ 1*p_2007 + 1*p_2008 + 1*p_2009 + 1*p_2010 + 1*p_2011 + 1*p_2012 + 1*p_2013
s.p =~ 0*p_2007 + 1*p_2008 + 2*p_2009 + 3*p_2010 + 4*p_2011 + 5*p_2012 + 6*p_2013
i.dt =~ 1*dt_2007 + 1*dt_2008 + 1*dt_2009 + 1*dt_2010 + 1*dt_2011 + 1*dt_2012 + 1*dt_2013
s.dt =~ 0*dt_2007 + 1*dt_2008 + 2*dt_2009 + 3*dt_2010 + 4*dt_2011 + 5*dt_2012 + 6*dt_2013
i.dc =~ 1*dc_2007 + 1*dc_2008 + 1*dc_2009 + 1*dc_2010 + 1*dc_2011 + 1*dc_2012 + 1*dc_2013
s.dc =~ 0*dc_2007 + 1*dc_2008 + 2*dc_2009 + 3*dc_2010 + 4*dc_2011 + 5*dc_2012 + 6*dc_2013

#regressions (regression on the IVs' growth curves)
i.ROA ~ i.hc + i.lc + i.pf + i.p + i.dt + i.df
s.ROA ~ s.hc + s.lc + s.pf + s.p + s.dt + s.df

# time-varying covariates (control variables) + time-invariant controls
ROA_2007 ~ CEO_2007 + brand_2007 + size_2007 + tier1_2007 + acquisitions_2007 + age + industry_ROA + TARP
ROA_2008 ~ CEO_2008 + brand_2008 + size_2008 + tier1_2008 + acquisitions_2008 + age + industry_ROA + TARP
ROA_2009 ~ CEO_2009 + brand_2009 + size_2009 + tier1_2009 + acquisitions_2009 + age + industry_ROA + TARP
ROA_2010 ~ CEO_2010 + brand_2010 + size_2010 + tier1_2010 + acquisitions_2010 + age + industry_ROA + TARP
ROA_2011 ~ CEO_2011 + brand_2011 + size_2011 + tier1_2011 + acquisitions_2011 + age + industry_ROA + TARP
ROA_2012 ~ CEO_2012 + brand_2012 + size_2012 + tier1_2012 + acquisitions_2012 + age + industry_ROA + TARP
ROA_2013 ~ CEO_2013 + brand_2013 + size_2013 + tier1_2013 + acquisitions_2013 + age + industry_ROA + TARP
'

# fit the model
fit <- growth(ETHthesismodel, data = inputdata, missing = "fiml")
summary(fit)

Harry Adraktas-Rentis

unread,
Apr 1, 2015, 10:16:38 AM4/1/15
to lav...@googlegroups.com

I tried running the model using RStudio but I got the following syntax error message which I don't know how to interpret

Error in lavParseModelString(model) : 
  lavaan ERROR: syntax error in lavaan model syntax

yrosseel

unread,
Apr 5, 2015, 4:38:00 AM4/5/15
to lav...@googlegroups.com
On 04/01/2015 04:16 PM, Harry Adraktas-Rentis wrote:
> I tried running the model using RStudio but I got the following syntax
> error message which I don't know how to interpret
>
> |Errorin lavParseModelString(model) :
> lavaan ERROR: syntax errorin lavaan model syntax|

Maybe this is an RStudio thing, and it was confused by the "'" character
in the comment " ... on the IVs' growth curves ... "

I can parse the syntax just fine.

Try this: store the syntax (everything withing the single quotes) in a
file called, say, "/tmp/myModel.txt" if you are on linux/mac, or
"c:/tmp/myModel.txt" if you are on windows.

Then, read in the model like this:

myModel <- readLines("tmp/myModel.txt") # or "c:/tmp/myModel.txt"

and then try

lavParseModelString(myModel)

If that works, you are ready to go.

Yves.

Harry Adraktas-Rentis

unread,
Apr 5, 2015, 6:36:50 AM4/5/15
to lav...@googlegroups.com
Hi Yves,

Thanks so much for responding once again! I have been reviewing the code and couldn't figure out what is wrong with it either, and the error message is not particularly helpful in that regard.

I tried to apply your solution, I created a .txt file including only the model

+ i.ROA =~ 1*ROA_2007 + 1*ROA_2008 + 1*ROA_2009 + 1*ROA_2010 + 1*ROA_2011 + 1*ROA_2012 + 1*ROA_2013
+ s.ROA =~ 0*ROA_2007 + 1*ROA_2008 + 2*ROA_2009 + 3*ROA_2010 + 4*ROA_2011 + 5*ROA_2012 + 6*ROA_2013
+ i.hc =~ 1*High_constr_2007 + 1*High_constr_2008 + 1*High_constr_2009 + 1*High_constr_2010 + 1*High_constr_2011 + 1*High_constr_2012 + 1*High_constr_2013
+ s.hc =~ 0*High_constr_2007 + 1*High_constr_2008 + 2*High_constr_2009 + 3*High_constr_2010 + 4*High_constr_2011 + 5*High_constr_2012 + 6*High_constr_2013
+ i.lc =~ 1*Low_constr_2007 + 1*Low_constr_2008 + 1*Low_constr_2009 + 1*Low_constr_2010 + 1*Low_constr_2011 + 1*Low_constr_2012 + 1*Low_constr_2013
+ s.lc =~ 0*Low_constr_2007 + 1*Low_constr_2008 + 2*Low_constr_2009 + 3*Low_constr_2010 + 4*Low_constr_2011 + 5*Low_constr_2012 + 6*Low_constr_2013
+ i.pf =~ 1*past_future_2007 + 1*past_future_2008 + 1*past_future_2009 + 1*past_future_2010 + 1*past_future_2011 + 1*past_future_2012 + 1*past_future_2013
+ s.pf =~ 0*past_future_2007 + 1*past_future_2008 + 2*past_future_2009 + 3*past_future_2010 + 4*past_future_2011 + 5*past_future_2012 + 6*past_future_2013
+ i.p =~ 1*present_2007 + 1*present_2008 + 1*present_2009 + 1*present_2010 + 1*present_2011 + 1*present_2012 + 1*present_2013
+ s.p =~ 0*present_2007 + 1*present_2008 + 2*present_2009 + 3*present_2010 + 4*present_2011 + 5*present_2012 + 6*present_2013
+ i.dt =~ 1*diff_temp_2007 + 1*diff_temp_2008 + 1*diff_temp_2009 + 1*diff_temp_2010 + 1*diff_temp_2011 + 1*diff_temp_2012 + 1*diff_temp_2013
+ s.dt =~ 0*diff_temp_2007 + 1*diff_temp_2008 + 2*diff_temp_2009 + 3*diff_temp_2010 + 4*diff_temp_2011 + 5*diff_temp_2012 + 6*diff_temp_2013
+ i.dc =~ 1*diff_constr_2007 + 1*diff_constr_2008 + 1*diff_constr_2009 + 1*diff_constr_2010 + 1*diff_constr_2011 + 1*diff_constr_2012 + 1*diff_constr_2013
+ s.dc =~ 0*diff_constr_2007 + 1*diff_constr_2008 + 2*diff_constr_2009 + 3*diff_constr_2010 + 4*diff_constr_2011 + 5*diff_constr_2012 + 6*diff_constr_2013
+ i.ROA ~ i.High_constr + i.Low_constr + i.past_future + i.p + i.dt + i.df
+ s.ROA ~ s.High_constr + s.Low_constr + s.past_future + s.p + s.dt + s.df
+ ROA_2007 ~ CEO_2007 + Brand_2007 + Size_2007 + Tier_1_2007 + Acquisitions_2007 + Ind_ROA_2007 + Age + TARP
+ ROA_2008 ~ CEO_2008 + Brand_2008 + Size_2008 + Tier_1_2008 + Acquisitions_2008 + Ind_ROA_2008 + Age + TARP
+ ROA_2009 ~ CEO_2009 + Brand_2009 + Size_2009 + Tier_1_2009 + Acquisitions_2009 + Ind_ROA_2009 + Age + TARP
+ ROA_2010 ~ CEO_2010 + Brand_2010 + Size_2010 + Tier_1_2010 + Acquisitions_2010 + Ind_ROA_2010 + Age + TARP
+ ROA_2011 ~ CEO_2011 + Brand_2011 + Size_2011 + Tier_1_2011 + Acquisitions_2011 + Ind_ROA_2011 + Age + TARP
+ ROA_2012 ~ CEO_2012 + Brand_2012 + Size_2012 + Tier_1_2012 + Acquisitions_2012 + Ind_ROA_2012 + Age + TARP
+ ROA_2013 ~ CEO_2013 + Brand_2013 + Size_2013 + Tier_1_2013 + Acquisitions_2013 + Ind_ROA_2013 + Age + TARP

and then read it with

> myModel <- 'readLines("c:/tmp/myModel.txt"")'

and tested it

> lavParseModelString(myModel)

but I still received the following error message:

lavaan: missing operator in formula(s):
[1] "readLines(\"c:/tmp/myModel.txt\"\")"
Error in lavParseModelString(myModel) : 
  lavaan ERROR: syntax error in lavaan model syntax

What does "missing operator in formulas" mean? I tried searching online but couldn't find an explanation.

Thanks again for your assistance, and have a nice weekend!

Best,
Harry



Yves.

yrosseel

unread,
Apr 5, 2015, 2:53:54 PM4/5/15
to lav...@googlegroups.com
On 04/05/2015 12:36 PM, Harry Adraktas-Rentis wrote:
> + i.ROA =~ 1*ROA_2007 + 1*ROA_2008 + 1*ROA_2009 + 1*ROA_2010 +

I hope you did not include the '+' symbols at the beginning of each line.

> and then read it with
>
>> myModel <- 'readLines("c:/tmp/myModel.txt"")'

Get rid of the single quotes, and make sure there is only one double
quote closing the string:

myModel <- readLines("c:/tmp/myModel.txt")

It that doesn't work, you will need to ask a local R guru to assist you.

Yves

Harry Adraktas-Rentis

unread,
Apr 5, 2015, 3:07:02 PM4/5/15
to lav...@googlegroups.com
Hi Yves,

Thanks once again for your response.

To be honest, I was unsure about including the + sign so I tried it both with and without to be on the safe side. I have removed the + signs now though.

I got rid of the single quotes and the second double quote and now I receive the following error message:

Warning message:
In readLines("c:/tmp/myModel.txt") :
  incomplete final line found on 'c:/tmp/myModel.txt'

Any idea what the "incomplete final line" may be referring to? I tried to include a single quote in the end of the syntax but that didn't help (apologies if that is completely irrelevant).

Thanks again!

Harry

yrosseel

unread,
Apr 5, 2015, 4:36:25 PM4/5/15
to lav...@googlegroups.com
On 04/05/2015 09:07 PM, Harry Adraktas-Rentis wrote:
> In readLines("c:/tmp/myModel.txt") :
> incomplete final line found on 'c:/tmp/myModel.txt'

Add another blank line at the bottom of that file...

Yves.

Harry Adraktas-Rentis

unread,
Apr 5, 2015, 5:31:24 PM4/5/15
to lav...@googlegroups.com
Hi Yves,

Thanks very much, that worked!

I hate to bother you again and I wish it was over, but I'm afraid I received another error message this time:

Error in parse(text = x) : <text>:1:84: unexpected INCOMPLETE_STRING
1: ~ CEO_2013+Brand_2013+Size_2013+Tier_1_2013+Acquisitions_2013+Ind_ROA_2013+Age+TARP'

This is the last equation of the model, but I don't know what "unexpected incomplete string" means exactly.

Terrence Jorgensen

unread,
Apr 6, 2015, 12:18:23 AM4/6/15
to lav...@googlegroups.com
I hate to bother you again and I wish it was over, but I'm afraid I received another error message this time:

Error in parse(text = x) : <text>:1:84: unexpected INCOMPLETE_STRING
1: ~ CEO_2013+Brand_2013+Size_2013+Tier_1_2013+Acquisitions_2013+Ind_ROA_2013+Age+TARP'

This is the last equation of the model, but I don't know what "unexpected incomplete string" means exactly.

It looks like your last line is missing "ROA_2013" as the regressand.  It would not make sense if the last line begins with an operator (~).  Also, I'll reiterate Yves' statement that the last line of your text file must be a blank line, which operates as the "end-of-file character" when R (or Mplus, LISREL, etc.) reads from text files.

Terry

Harry Adraktas-Rentis

unread,
Apr 6, 2015, 5:24:24 AM4/6/15
to lav...@googlegroups.com
Hi Terry,

Thanks for your help!
 
It looks like your last line is missing "ROA_2013" as the regressand.  It would not make sense if the last line begins with an operator (~).
I reread the txt file just in case, but ROA_2013 is not missing from the last line and unless I am missing something the regressand (ROA) and all the regressors are there as per the code I submitted above. The last line is exactly similar to the previous ones regarding the control variables so could it be something else that triggers this error? 

Also, I'll reiterate Yves' statement that the last line of your text file must be a blank line, which operates as the "end-of-file character" when R (or Mplus, LISREL, etc.) reads from text files.
Thank you for your affirmation and clarification, I did not know that detail to be honest. I changed the text file though and that is why I no longer receive that error message, only the one about the incomplete string.
 

--
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/uZgXzgBoEKA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.

Terrence Jorgensen

unread,
Apr 7, 2015, 1:46:17 AM4/7/15
to lav...@googlegroups.com
Why are you reading your lavaan model syntax from an external file?  If you copy/paste that syntax into a character string in your R syntax (as seen in every example on the lavaan web site), do you still get the error?  Please post that entire R syntax and possibly some data so that the problem can be reproduced.  Also, can you provide the output of:

sessionInfo()

just to be thorough?

Harry Adraktas-Rentis

unread,
Apr 7, 2015, 6:02:50 AM4/7/15
to lav...@googlegroups.com
Hi Terry,

Well, as you can read in my previous posts, when I initially attempted to read/fit the model in RStudio directly, I received the following error message:

Error in lavParseModelString(model) : 
  lavaan ERROR: syntax error in lavaan model syntax

That is why Yves suggested to read the model from an external file, which seems to be working (even though I receive another error message now).

Here is the entire R syntax, for your reference. It is not easy for me to post my data here since I have multiple measurements and thus I end up with 5 observations over 94 variables (unless there is a way to attach a .txt file somehow?)

inputdata = read.table("C:\Users\Haris\Desktop\inputdata.txt")  # read text file 

ETHthesismodel <- '
# intercept and slope with fixed coefficients (time-varying variables - DV & IVs)
+ i.ROA =~ 1*ROA_2007 + 1*ROA_2008 + 1*ROA_2009 + 1*ROA_2010 + 1*ROA_2011 + 1*ROA_2012 + 1*ROA_2013
+ s.ROA =~ 0*ROA_2007 + 1*ROA_2008 + 2*ROA_2009 + 3*ROA_2010 + 4*ROA_2011 + 5*ROA_2012 + 6*ROA_2013
+ i.hc =~ 1*High_constr_2007 + 1*High_constr_2008 + 1*High_constr_2009 + 1*High_constr_2010 + 1*High_constr_2011 + 1*High_constr_2012 + 1*High_constr_2013
+ s.hc =~ 0*High_constr_2007 + 1*High_constr_2008 + 2*High_constr_2009 + 3*High_constr_2010 + 4*High_constr_2011 + 5*High_constr_2012 + 6*High_constr_2013
+ i.lc =~ 1*Low_constr_2007 + 1*Low_constr_2008 + 1*Low_constr_2009 + 1*Low_constr_2010 + 1*Low_constr_2011 + 1*Low_constr_2012 + 1*Low_constr_2013
+ s.lc =~ 0*Low_constr_2007 + 1*Low_constr_2008 + 2*Low_constr_2009 + 3*Low_constr_2010 + 4*Low_constr_2011 + 5*Low_constr_2012 + 6*Low_constr_2013
+ i.pf =~ 1*past_future_2007 + 1*past_future_2008 + 1*past_future_2009 + 1*past_future_2010 + 1*past_future_2011 + 1*past_future_2012 + 1*past_future_2013
+ s.pf =~ 0*past_future_2007 + 1*past_future_2008 + 2*past_future_2009 + 3*past_future_2010 + 4*past_future_2011 + 5*past_future_2012 + 6*past_future_2013
+ i.p =~ 1*present_2007 + 1*present_2008 + 1*present_2009 + 1*present_2010 + 1*present_2011 + 1*present_2012 + 1*present_2013
+ s.p =~ 0*present_2007 + 1*present_2008 + 2*present_2009 + 3*present_2010 + 4*present_2011 + 5*present_2012 + 6*present_2013
+ i.dt =~ 1*diff_temp_2007 + 1*diff_temp_2008 + 1*diff_temp_2009 + 1*diff_temp_2010 + 1*diff_temp_2011 + 1*diff_temp_2012 + 1*diff_temp_2013
+ s.dt =~ 0*diff_temp_2007 + 1*diff_temp_2008 + 2*diff_temp_2009 + 3*diff_temp_2010 + 4*diff_temp_2011 + 5*diff_temp_2012 + 6*diff_temp_2013
+ i.dc =~ 1*diff_constr_2007 + 1*diff_constr_2008 + 1*diff_constr_2009 + 1*diff_constr_2010 + 1*diff_constr_2011 + 1*diff_constr_2012 + 1*diff_constr_2013
+ s.dc =~ 0*diff_constr_2007 + 1*diff_constr_2008 + 2*diff_constr_2009 + 3*diff_constr_2010 + 4*diff_constr_2011 + 5*diff_constr_2012 + 6*diff_constr_2013


#regressions (regression on the IV's growth curves)
+ i.ROA ~ i.High_constr + i.Low_constr + i.past_future + i.p + i.dt + i.df
+ s.ROA ~ s.High_constr + s.Low_constr + s.past_future + s.p + s.dt + s.df

# time-varying covariates (time varying _ time-invariant control variables)
+ ROA_2007 ~ CEO_2007 + Brand_2007 + Size_2007 + Tier_1_2007 + Acquisitions_2007 + Ind_ROA_2007 + Age + TARP
+ ROA_2008 ~ CEO_2008 + Brand_2008 + Size_2008 + Tier_1_2008 + Acquisitions_2008 + Ind_ROA_2008 + Age + TARP
+ ROA_2009 ~ CEO_2009 + Brand_2009 + Size_2009 + Tier_1_2009 + Acquisitions_2009 + Ind_ROA_2009 + Age + TARP
+ ROA_2010 ~ CEO_2010 + Brand_2010 + Size_2010 + Tier_1_2010 + Acquisitions_2010 + Ind_ROA_2010 + Age + TARP
+ ROA_2011 ~ CEO_2011 + Brand_2011 + Size_2011 + Tier_1_2011 + Acquisitions_2011 + Ind_ROA_2011 + Age + TARP
+ ROA_2012 ~ CEO_2012 + Brand_2012 + Size_2012 + Tier_1_2012 + Acquisitions_2012 + Ind_ROA_2012 + Age + TARP
+ ROA_2013 ~ CEO_2013 + Brand_2013 + Size_2013 + Tier_1_2013 + Acquisitions_2013 + Ind_ROA_2013 + Age + TARP
+ '

# load lavaan
library(lavaan)

# fit the model
fit <- growth (ETHthesismodel, data = inputdata, missing = "fiml")
summary(fit)

Here is the info from sessionInfo() too:

> sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] lavaan_0.5-17

loaded via a namespace (and not attached):
[1] mnormt_1.5-1   pbivnorm_0.6.0 quadprog_1.5-5 stats4_3.1.3  
[5] tools_3.1.3   

Hope this helps. I sincerely appreciate any help or suggestions

--

Harry Adraktas-Rentis

unread,
Apr 8, 2015, 10:04:10 AM4/8/15
to lav...@googlegroups.com
Hi,

I found some typos in the syntax (n the variable names) and even though I still receive the same error message (i.e. 
Error in lavParseModelString(model) : 
  lavaan ERROR: syntax error in lavaan model syntax
when trying to run the model directly in RStudio, I was able to read it externally and test it with "lavParseModelString" (I don't know what this command does though, to be honest). The output can be found below if it is of any use. However, when I tried to fit this new model ("myModel") via 

> fit <- growth (myModel, data = input.data, missing = "fiml")

I received a different error, namely:

Error in lav_data_full(data = data, group = group, group.label = group.label,  : 
  lavaan ERROR: some variables have no values (only missings) or no variance

In my model, some variables do indeed have a zero variance. Since I have multiple measurements (and thus I have created different variables for each measurement), and  some variables are dummy (binary) variables, on certain years all cases (firms) have the same "value" (for example, 0 if none changed their CEO) and therefore this year-variable will have zero variance between the units. Is that a problem in lavaan? If that is the case, I will probably need to modify my model, possibly quite extensively. Thank you in advance for any assistance.

> lavParseModelString(myModel)
$lhs
  [1] "i.ROA"    "i.ROA"    "i.ROA"    "i.ROA"    "i.ROA"   
  [6] "i.ROA"    "i.ROA"    "s.ROA"    "s.ROA"    "s.ROA"   
 [11] "s.ROA"    "s.ROA"    "s.ROA"    "s.ROA"    "i.hc"    
 [16] "i.hc"     "i.hc"     "i.hc"     "i.hc"     "i.hc"    
 [21] "i.hc"     "s.hc"     "s.hc"     "s.hc"     "s.hc"    
 [26] "s.hc"     "s.hc"     "s.hc"     "i.lc"     "i.lc"    
 [31] "i.lc"     "i.lc"     "i.lc"     "i.lc"     "i.lc"    
 [36] "s.lc"     "s.lc"     "s.lc"     "s.lc"     "s.lc"    
 [41] "s.lc"     "s.lc"     "i.pf"     "i.pf"     "i.pf"    
 [46] "i.pf"     "i.pf"     "i.pf"     "i.pf"     "s.pf"    
 [51] "s.pf"     "s.pf"     "s.pf"     "s.pf"     "s.pf"    
 [56] "s.pf"     "i.p"      "i.p"      "i.p"      "i.p"     
 [61] "i.p"      "i.p"      "i.p"      "s.p"      "s.p"     
 [66] "s.p"      "s.p"      "s.p"      "s.p"      "s.p"     
 [71] "i.dt"     "i.dt"     "i.dt"     "i.dt"     "i.dt"    
 [76] "i.dt"     "i.dt"     "s.dt"     "s.dt"     "s.dt"    
 [81] "s.dt"     "s.dt"     "s.dt"     "s.dt"     "i.dc"    
 [86] "i.dc"     "i.dc"     "i.dc"     "i.dc"     "i.dc"    
 [91] "i.dc"     "s.dc"     "s.dc"     "s.dc"     "s.dc"    
 [96] "s.dc"     "s.dc"     "s.dc"     "i.ROA"    "i.ROA"   
[101] "i.ROA"    "i.ROA"    "i.ROA"    "i.ROA"    "s.ROA"   
[106] "s.ROA"    "s.ROA"    "s.ROA"    "s.ROA"    "s.ROA"   
[111] "ROA_2007" "ROA_2007" "ROA_2007" "ROA_2007" "ROA_2007"
[116] "ROA_2007" "ROA_2007" "ROA_2007" "ROA_2008" "ROA_2008"
[121] "ROA_2008" "ROA_2008" "ROA_2008" "ROA_2008" "ROA_2008"
[126] "ROA_2008" "ROA_2009" "ROA_2009" "ROA_2009" "ROA_2009"
[131] "ROA_2009" "ROA_2009" "ROA_2009" "ROA_2009" "ROA_2010"
[136] "ROA_2010" "ROA_2010" "ROA_2010" "ROA_2010" "ROA_2010"
[141] "ROA_2010" "ROA_2010" "ROA_2011" "ROA_2011" "ROA_2011"
[146] "ROA_2011" "ROA_2011" "ROA_2011" "ROA_2011" "ROA_2011"
[151] "ROA_2012" "ROA_2012" "ROA_2012" "ROA_2012" "ROA_2012"
[156] "ROA_2012" "ROA_2012" "ROA_2012" "ROA_2013" "ROA_2013"
[161] "ROA_2013" "ROA_2013" "ROA_2013" "ROA_2013" "ROA_2013"
[166] "ROA_2013"

$op
  [1] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [12] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [23] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [34] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [45] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [56] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [67] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [78] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~"
 [89] "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "=~" "~" 
[100] "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~" 
[111] "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~" 
[122] "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~" 
[133] "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~" 
[144] "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~" 
[155] "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~"  "~" 
[166] "~" 

$rhs
  [1] "ROA_2007"          "ROA_2008"         
  [3] "ROA_2009"          "ROA_2010"         
  [5] "ROA_2011"          "ROA_2012"         
  [7] "ROA_2013"          "ROA_2007"         
  [9] "ROA_2008"          "ROA_2009"         
 [11] "ROA_2010"          "ROA_2011"         
 [13] "ROA_2012"          "ROA_2013"         
 [15] "High_constr_2007"  "High_constr_2008" 
 [17] "High_constr_2009"  "High_constr_2010" 
 [19] "High_constr_2011"  "High_constr_2012" 
 [21] "High_constr_2013"  "High_constr_2007" 
 [23] "High_constr_2008"  "High_constr_2009" 
 [25] "High_constr_2010"  "High_constr_2011" 
 [27] "High_constr_2012"  "High_constr_2013" 
 [29] "Low_constr_2007"   "Low_constr_2008"  
 [31] "Low_constr_2009"   "Low_constr_2010"  
 [33] "Low_constr_2011"   "Low_constr_2012"  
 [35] "Low_constr_2013"   "Low_constr_2007"  
 [37] "Low_constr_2008"   "Low_constr_2009"  
 [39] "Low_constr_2010"   "Low_constr_2011"  
 [41] "Low_constr_2012"   "Low_constr_2013"  
 [43] "past_future_2007"  "past_future_2008" 
 [45] "past_future_2009"  "past_future_2010" 
 [47] "past_future_2011"  "past_future_2012" 
 [49] "past_future_2013"  "past_future_2007" 
 [51] "past_future_2008"  "past_future_2009" 
 [53] "past_future_2010"  "past_future_2011" 
 [55] "past_future_2012"  "past_future_2013" 
 [57] "present_2007"      "present_2008"     
 [59] "present_2009"      "present_2010"     
 [61] "present_2011"      "present_2012"     
 [63] "present_2013"      "present_2007"     
 [65] "present_2008"      "present_2009"     
 [67] "present_2010"      "present_2011"     
 [69] "present_2012"      "present_2013"     
 [71] "diff_temp_2007"    "diff_temp_2008"   
 [73] "diff_temp_2009"    "diff_temp_2010"   
 [75] "diff_temp_2011"    "diff_temp_2012"   
 [77] "diff_temp_2013"    "diff_temp_2007"   
 [79] "diff_temp_2008"    "diff_temp_2009"   
 [81] "diff_temp_2010"    "diff_temp_2011"   
 [83] "diff_temp_2012"    "diff_temp_2013"   
 [85] "diff_constr_2007"  "diff_constr_2008" 
 [87] "diff_constr_2009"  "diff_constr_2010" 
 [89] "diff_constr_2011"  "diff_constr_2012" 
 [91] "diff_constr_2013"  "diff_constr_2007" 
 [93] "diff_constr_2008"  "diff_constr_2009" 
 [95] "diff_constr_2010"  "diff_constr_2011" 
 [97] "diff_constr_2012"  "diff_constr_2013" 
 [99] "i.hc"              "i.lc"             
[101] "i.pf"              "i.p"              
[103] "i.dt"              "i.dc"             
[105] "s.hc"              "s.lc"             
[107] "s.pf"              "s.p"              
[109] "s.dt"              "s.dc"             
[111] "CEO_2007"          "Brand_2007"       
[113] "Size_2007"         "Tier_1_2007"      
[115] "Acquisitions_2007" "Ind_ROA_2007"     
[117] "Age"               "TARP"             
[119] "CEO_2008"          "Brand_2008"       
[121] "Size_2008"         "Tier_1_2008"      
[123] "Acquisitions_2008" "Ind_ROA_2008"     
[125] "Age"               "TARP"             
[127] "CEO_2009"          "Brand_2009"       
[129] "Size_2009"         "Tier_1_2009"      
[131] "Acquisitions_2009" "Ind_ROA_2009"     
[133] "Age"               "TARP"             
[135] "CEO_2010"          "Brand_2010"       
[137] "Size_2010"         "Tier_1_2010"      
[139] "Acquisitions_2010" "Ind_ROA_2010"     
[141] "Age"               "TARP"             
[143] "CEO_2011"          "Brand_2011"       
[145] "Size_2011"         "Tier_1_2011"      
[147] "Acquisitions_2011" "Ind_ROA_2011"     
[149] "Age"               "TARP"             
[151] "CEO_2012"          "Brand_2012"       
[153] "Size_2012"         "Tier_1_2012"      
[155] "Acquisitions_2012" "Ind_ROA_2012"     
[157] "Age"               "TARP"             
[159] "CEO_2013"          "Brand_2013"       
[161] "Size_2013"         "Tier_1_2013"      
[163] "Acquisitions_2013" "Ind_ROA_2013"     
[165] "Age"               "TARP"             

$mod.idx
  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
 [20] 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 [39] 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
 [58] 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
 [77] 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
 [96] 96 97 98  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
[115]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
[134]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
[153]  0  0  0  0  0  0  0  0  0  0  0  0  0  0

$group
  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [30] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [59] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 [88] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[117] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[146] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

$fixed
  [1] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [15] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [29] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [43] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [57] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [71] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [85] "1" "1" "1" "1" "1" "1" "1" "0" "1" "2" "3" "4" "5" "6"
 [99] ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  "" 
[113] ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  "" 
[127] ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  "" 
[141] ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  "" 
[155] ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  ""  "" 

$start
  [1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [20] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [39] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [58] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [77] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [96] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[115] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[134] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[153] "" "" "" "" "" "" "" "" "" "" "" "" "" ""

$label
  [1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [20] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [39] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [58] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [77] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
 [96] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[115] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[134] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
[153] "" "" "" "" "" "" "" "" "" "" "" "" "" ""

attr(,"modifiers")
attr(,"modifiers")[[1]]
attr(,"modifiers")[[1]]$fixed
[1] 1


attr(,"modifiers")[[2]]
attr(,"modifiers")[[2]]$fixed
[1] 1


attr(,"modifiers")[[3]]
attr(,"modifiers")[[3]]$fixed
[1] 1


attr(,"modifiers")[[4]]
attr(,"modifiers")[[4]]$fixed
[1] 1


attr(,"modifiers")[[5]]
attr(,"modifiers")[[5]]$fixed
[1] 1


attr(,"modifiers")[[6]]
attr(,"modifiers")[[6]]$fixed
[1] 1


attr(,"modifiers")[[7]]
attr(,"modifiers")[[7]]$fixed
[1] 1


attr(,"modifiers")[[8]]
attr(,"modifiers")[[8]]$fixed
[1] 0


attr(,"modifiers")[[9]]
attr(,"modifiers")[[9]]$fixed
[1] 1


attr(,"modifiers")[[10]]
attr(,"modifiers")[[10]]$fixed
[1] 2


attr(,"modifiers")[[11]]
attr(,"modifiers")[[11]]$fixed
[1] 3


attr(,"modifiers")[[12]]
attr(,"modifiers")[[12]]$fixed
[1] 4


attr(,"modifiers")[[13]]
attr(,"modifiers")[[13]]$fixed
[1] 5


attr(,"modifiers")[[14]]
attr(,"modifiers")[[14]]$fixed
[1] 6


attr(,"modifiers")[[15]]
attr(,"modifiers")[[15]]$fixed
[1] 1


attr(,"modifiers")[[16]]
attr(,"modifiers")[[16]]$fixed
[1] 1


attr(,"modifiers")[[17]]
attr(,"modifiers")[[17]]$fixed
[1] 1


attr(,"modifiers")[[18]]
attr(,"modifiers")[[18]]$fixed
[1] 1


attr(,"modifiers")[[19]]
attr(,"modifiers")[[19]]$fixed
[1] 1


attr(,"modifiers")[[20]]
attr(,"modifiers")[[20]]$fixed
[1] 1


attr(,"modifiers")[[21]]
attr(,"modifiers")[[21]]$fixed
[1] 1


attr(,"modifiers")[[22]]
attr(,"modifiers")[[22]]$fixed
[1] 0


attr(,"modifiers")[[23]]
attr(,"modifiers")[[23]]$fixed
[1] 1


attr(,"modifiers")[[24]]
attr(,"modifiers")[[24]]$fixed
[1] 2


attr(,"modifiers")[[25]]
attr(,"modifiers")[[25]]$fixed
[1] 3


attr(,"modifiers")[[26]]
attr(,"modifiers")[[26]]$fixed
[1] 4


attr(,"modifiers")[[27]]
attr(,"modifiers")[[27]]$fixed
[1] 5


attr(,"modifiers")[[28]]
attr(,"modifiers")[[28]]$fixed
[1] 6


attr(,"modifiers")[[29]]
attr(,"modifiers")[[29]]$fixed
[1] 1


attr(,"modifiers")[[30]]
attr(,"modifiers")[[30]]$fixed
[1] 1


attr(,"modifiers")[[31]]
attr(,"modifiers")[[31]]$fixed
[1] 1


attr(,"modifiers")[[32]]
attr(,"modifiers")[[32]]$fixed
[1] 1


attr(,"modifiers")[[33]]
attr(,"modifiers")[[33]]$fixed
[1] 1


attr(,"modifiers")[[34]]
attr(,"modifiers")[[34]]$fixed
[1] 1


attr(,"modifiers")[[35]]
attr(,"modifiers")[[35]]$fixed
[1] 1


attr(,"modifiers")[[36]]
attr(,"modifiers")[[36]]$fixed
[1] 0


attr(,"modifiers")[[37]]
attr(,"modifiers")[[37]]$fixed
[1] 1


attr(,"modifiers")[[38]]
attr(,"modifiers")[[38]]$fixed
[1] 2


attr(,"modifiers")[[39]]
attr(,"modifiers")[[39]]$fixed
[1] 3


attr(,"modifiers")[[40]]
attr(,"modifiers")[[40]]$fixed
[1] 4


attr(,"modifiers")[[41]]
attr(,"modifiers")[[41]]$fixed
[1] 5


attr(,"modifiers")[[42]]
attr(,"modifiers")[[42]]$fixed
[1] 6


attr(,"modifiers")[[43]]
attr(,"modifiers")[[43]]$fixed
[1] 1


attr(,"modifiers")[[44]]
attr(,"modifiers")[[44]]$fixed
[1] 1


attr(,"modifiers")[[45]]
attr(,"modifiers")[[45]]$fixed
[1] 1


attr(,"modifiers")[[46]]
attr(,"modifiers")[[46]]$fixed
[1] 1


attr(,"modifiers")[[47]]
attr(,"modifiers")[[47]]$fixed
[1] 1


attr(,"modifiers")[[48]]
attr(,"modifiers")[[48]]$fixed
[1] 1


attr(,"modifiers")[[49]]
attr(,"modifiers")[[49]]$fixed
[1] 1


attr(,"modifiers")[[50]]
attr(,"modifiers")[[50]]$fixed
[1] 0


attr(,"modifiers")[[51]]
attr(,"modifiers")[[51]]$fixed
[1] 1


attr(,"modifiers")[[52]]
attr(,"modifiers")[[52]]$fixed
[1] 2


attr(,"modifiers")[[53]]
attr(,"modifiers")[[53]]$fixed
[1] 3


attr(,"modifiers")[[54]]
attr(,"modifiers")[[54]]$fixed
[1] 4


attr(,"modifiers")[[55]]
attr(,"modifiers")[[55]]$fixed
[1] 5


attr(,"modifiers")[[56]]
attr(,"modifiers")[[56]]$fixed
[1] 6


attr(,"modifiers")[[57]]
attr(,"modifiers")[[57]]$fixed
[1] 1


attr(,"modifiers")[[58]]
attr(,"modifiers")[[58]]$fixed
[1] 1


attr(,"modifiers")[[59]]
attr(,"modifiers")[[59]]$fixed
[1] 1


attr(,"modifiers")[[60]]
attr(,"modifiers")[[60]]$fixed
[1] 1


attr(,"modifiers")[[61]]
attr(,"modifiers")[[61]]$fixed
[1] 1


attr(,"modifiers")[[62]]
attr(,"modifiers")[[62]]$fixed
[1] 1


attr(,"modifiers")[[63]]
attr(,"modifiers")[[63]]$fixed
[1] 1


attr(,"modifiers")[[64]]
attr(,"modifiers")[[64]]$fixed
[1] 0


attr(,"modifiers")[[65]]
attr(,"modifiers")[[65]]$fixed
[1] 1


attr(,"modifiers")[[66]]
attr(,"modifiers")[[66]]$fixed
[1] 2


attr(,"modifiers")[[67]]
attr(,"modifiers")[[67]]$fixed
[1] 3


attr(,"modifiers")[[68]]
attr(,"modifiers")[[68]]$fixed
[1] 4


attr(,"modifiers")[[69]]
attr(,"modifiers")[[69]]$fixed
[1] 5


attr(,"modifiers")[[70]]
attr(,"modifiers")[[70]]$fixed
[1] 6


attr(,"modifiers")[[71]]
attr(,"modifiers")[[71]]$fixed
[1] 1


attr(,"modifiers")[[72]]
attr(,"modifiers")[[72]]$fixed
[1] 1


attr(,"modifiers")[[73]]
attr(,"modifiers")[[73]]$fixed
[1] 1


attr(,"modifiers")[[74]]
attr(,"modifiers")[[74]]$fixed
[1] 1


attr(,"modifiers")[[75]]
attr(,"modifiers")[[75]]$fixed
[1] 1


attr(,"modifiers")[[76]]
attr(,"modifiers")[[76]]$fixed
[1] 1


attr(,"modifiers")[[77]]
attr(,"modifiers")[[77]]$fixed
[1] 1


attr(,"modifiers")[[78]]
attr(,"modifiers")[[78]]$fixed
[1] 0


attr(,"modifiers")[[79]]
attr(,"modifiers")[[79]]$fixed
[1] 1


attr(,"modifiers")[[80]]
attr(,"modifiers")[[80]]$fixed
[1] 2


attr(,"modifiers")[[81]]
attr(,"modifiers")[[81]]$fixed
[1] 3


attr(,"modifiers")[[82]]
attr(,"modifiers")[[82]]$fixed
[1] 4


attr(,"modifiers")[[83]]
attr(,"modifiers")[[83]]$fixed
[1] 5


attr(,"modifiers")[[84]]
attr(,"modifiers")[[84]]$fixed
[1] 6


attr(,"modifiers")[[85]]
attr(,"modifiers")[[85]]$fixed
[1] 1


attr(,"modifiers")[[86]]
attr(,"modifiers")[[86]]$fixed
[1] 1


attr(,"modifiers")[[87]]
attr(,"modifiers")[[87]]$fixed
[1] 1


attr(,"modifiers")[[88]]
attr(,"modifiers")[[88]]$fixed
[1] 1


attr(,"modifiers")[[89]]
attr(,"modifiers")[[89]]$fixed
[1] 1


attr(,"modifiers")[[90]]
attr(,"modifiers")[[90]]$fixed
[1] 1


attr(,"modifiers")[[91]]
attr(,"modifiers")[[91]]$fixed
[1] 1


attr(,"modifiers")[[92]]
attr(,"modifiers")[[92]]$fixed
[1] 0


attr(,"modifiers")[[93]]
attr(,"modifiers")[[93]]$fixed
[1] 1


attr(,"modifiers")[[94]]
attr(,"modifiers")[[94]]$fixed
[1] 2


attr(,"modifiers")[[95]]
attr(,"modifiers")[[95]]$fixed
[1] 3


attr(,"modifiers")[[96]]
attr(,"modifiers")[[96]]$fixed
[1] 4


attr(,"modifiers")[[97]]
attr(,"modifiers")[[97]]$fixed
[1] 5


attr(,"modifiers")[[98]]
attr(,"modifiers")[[98]]$fixed
[1] 6


attr(,"constraints")
list()

Xiaochen Dai

unread,
Jan 4, 2018, 8:29:45 PM1/4/18
to lavaan
Dear Yves,

I am reading this post from almost 3 years ago and still find your answer very useful! Thank you very much! 
I am currently doing a similar analysis but my data is unbalanced. In my dataset, each country (each group) has different number of waves and the time of the waves are different too. In this case, can I still using lavaan to fit a multiple groups latent growth model? 

Below is a more detailed post for my research question and context. I'll be very appreciative to hear from you. Thank you very much!

"I am trying to fit a latent growth model using a longitudinal, multiple groups dataset. Basically, I have national estimates on 10+ observed HIV knowledge indicators in about 20 countries over time from 1990 to 2016 and I try to use LGM to estimate the latent value of HIV knowledge using the observed indicators for each country over time. The problem is that the longitudinal data is unbalanced, meaning that national estimates on HIV knowledge are from different years for different countries (e.g. for some countries there are estimates in 1994 but in others they have estimates in 2000) and that the number of estimates is different from different countries (e.g. some countries may have 2 estimates for the indicators over the whole period but some other countries may have 5 estimates).

My question is, in this case, can I still use multiple groups LGM to fit the data and if the answer is yes, can I use lavaan to do the analysis? "

best,
Xiaochen
Reply all
Reply to author
Forward
0 new messages