P_et, P_hi and P_au are climatic variables associated with each site, but they vary according to my tree rings because each ring is associated with a specific year which had a certain climate (could this complicate things?).
If they vary within the “tree” level, then they are tree-level predictors. If you had repeated measures over time nested within human subjects, age is a “variable associated with” people, but it is not a person-level predictor because age changes within person. So you have to treat age as a time-varying predictor. Sounds like your climatic variables vary within each tree, which makes sense because climate changes over time as the trees grow.
Since lavaan can only handle 2 levels, I decided that my first level would be my ring, and my second level would be my site
Seems bad to ignore the effect of tree. How many sites do you have? You could make dummy codes to partial out the (fixed) effects of between-site variability. If you set fixed.x=TRUE and conditional.x=TRUE, lavaan() will fit the model to the residual covariance matrices after partialing out the effect of site.
I am getting an error message that I do not understand. After reading up, it seems that it could be because of my model specification, having place my variables in the wrong levels.
Error in if (fx.delta < tol) { : missing value where TRUE/FALSE needed
No, this happens because when lavaan is estimating the separate within and between components of the covariance matrix and mean vector using the EM algorithm, it is checking an internally stored value “fx” to see how much it changed (fx.delta) at the current iteration. If the change is close enough to zero (i.e., < tol), the EM algorithm as “converged”. For some reason, that value is missing (NA), so when it is checked by if (...), it returns an error because NA is neither TRUE nor FALSE.
This issue might have already been resolved in the development version, which you can install:
If the problem persists, please post your syntax and enough data to reproduce the error, so the reason for that NA can hopefully be tracked down and fixed.
Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam
http://www.uva.nl/profile/t.d.jorgensen