3 error messages in lavaan with transformed data

267 views
Skip to first unread message

hasna akub

unread,
Apr 26, 2014, 10:48:48 PM4/26/14
to lav...@googlegroups.com
I built the model with one latent variable (WDI that was calculated by sum dam+ditch + aqued then standardized the result). for other variables, I used transformed data (look the attachment) because the original data is not normally distributed.

library(lavaan)
model <- '
# measurement model
WDI =~ ln.dams + ln.ditch +ln.aqued (should I use original or transformed variables to build latent variable???)

# regressions
ln.intro ~ WDI+asn.dev+ln.area+sqr.diversity
sqr.impact ~ ln.intro+WDI+asn.dev+sqr.diversity
sqr.diversity ~ ln.area

# residual correlations
WDI ~~ asn.dev 
WDI ~~ ln.area 
asn.dev ~~ ln.area'

fit.light <- sem(model, data = light)
summary(fit.light, standardized = TRUE)
 
however, when I built the model  I have 3 error messages which are
Warning messages:
1: In vnames(FLAT, "ov.x", warn = TRUE) :
  lavaan WARNING: model syntax contains variance/covariance/intercept formulas
  involving (an) exogenous variable(s): [asn.dev ln.area];
  Please use fixed.x=FALSE or leave them alone
2: In lavaan::lavaan(model = model, data = light, model.type = "sem",  :
  lavaan WARNING: some estimated variances are negative
3: In lavaan::lavaan(model = model, data = light, model.type = "sem",  :
  lavaan WARNING: covariance matrix of latent variables is not positive definite; use inspect(fit,"cov.lv") to investigate. 

so, I am wondering what mistake I had to have those error.
Should I use original data instead? 
 
light.csv

Jeremy Miles

unread,
Apr 27, 2014, 1:21:10 AM4/27/14
to lav...@googlegroups.com
Transformations have nothing to do with these warnings. 

1. You have asn.dev ~~ ln.area, this is the cause of the first warning. As it says, leave it alone.

2. You have negative estimated variances, this suggests that your model is misspecified (although if they're only a teeny bit negative, don't worry.

3. The covariance matrix of your latent variables cannot occur with real data. This also suggests that your model is misspecified.

Hope that helps,

Jeremy




--
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 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.

hasna akub

unread,
Apr 27, 2014, 10:53:39 AM4/27/14
to lav...@googlegroups.com
Thanks for help. 
I have a question; what do you mean by saying leave it alone. what should I do?

yrosseel

unread,
Apr 27, 2014, 11:03:12 AM4/27/14
to lav...@googlegroups.com
On 04/27/2014 04:53 PM, hasna akub wrote:
> *Thanks for help. *
> *I have a question; what do you mean by saying leave it alone. what
> should I do?*

Remove the line 'asn.dev ~~ ln.area' from your model syntax.

Yves.
Reply all
Reply to author
Forward
0 new messages