Hi Miles and Yves, 

I agree with Miles to use lavaan to do regression so that FIML can be used. This is one of the amazing things that lavaan can do. If lavaan can handle missing values for the univariate regression using FIML, I don't see why you want to avoid it.




ya

From: Andrew Miles
Date: 2012-07-23 16:07
To: yrosseel
CC: r-help
Subject: Re: [R] FIML using lavaan returns zeroes for coefficients
Thanks for the helpful explanation.  

As to your question, I sometimes use lavaan to fit univariate regressions simply because it can handle missing data using FIML rather than listwise deletion.  Are there reasons to avoid this?

BTW, thanks for the update in the development version.

Andrew Miles


On Jul 21, 2012, at 12:59 PM, yrosseel wrote:

> On 07/20/2012 10:35 PM, Andrew Miles wrote:
>> Hello!
>> 
>> I am trying to reproduce (for a publication) analyses that I ran
>> several months ago using lavaan, I'm not sure which version, probably
>> 0.4-12. A sample model is given below:
>> 
>> pathmod='mh30days.log.w2 ~ mh30days.log + joingroup + leavegroup +
>> alwaysgroup + grp.partic.w2 + black + age + bivoc + moved.conf +
>> local.noretired + retired + ds + ministrytime + hrswork +
>> nomoralescore.c + negint.c + cong.conflict.c + nomoraleXjoin +
>> nomoraleXleave + nomoraleXalways + negintXjoin + negintXleave +
>> negintXalways + conflictXjoin + conflictXleave + conflictXalways '
>> mod1 = sem(pathmod, data=sampledat, missing="fiml", se="robust")
>> 
>> At the time, the model ran fine.  Now, using version 0.4-14, the
>> model returns all 0's for coefficients.
> 
> What happened is that since 0.4-14, lavaan tries to 'detect' models that are just univariate regression, and internally calls lm.fit, instead of the lavaan estimation engine, at least when the missing="ml" argument is NOT used. (BTW, I fail to understand why you would use lavaan if you just want to fit a univariate regression).
> 
> When missing="ml" is used, lavaan normally checks if you have fixed x covariates (which you do), and if fixed.x=TRUE (which is the default). In 0.4, lavaan internally switches to fixed.x=FALSE (which implicitly assumes that all your predictors are continuous, but I assume you would not using missing="ml" otherwise). Unfortunately, for the 'special' case of univariate regression, it fails to do this. This behavior will likely change in 0.5, where, by default, only endogenous/dependent variables will be handled by missing="ml", not exogenous 'x' covariates.
> 
> To fix it: simply add the fixed.x=FALSE argument, or revert to 0.4-12 to get the old behavior.
> 
> Hope this helps,
> 
> Yves.
> http://lavaan.org
> 
> 
> 

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
	[[alternative HTML version deleted]]

