Skip to content

FIML using lavaan returns zeroes for coefficients

5 messages · Andrew Miles, yrosseel, ya +1 more

#
On 07/20/2012 10:35 PM, Andrew Miles wrote:
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
1 day later
#
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:

            
#
Hi Andrew,

I do not think there is a reason to avoid it for univariate regression
other than:

1) as was stated the predictors must be continuous
2) it will be slower (non issue for a handful of regressions on a few
thousand cases but for people doing thousands of regression on
millions of observations, a big concern)

In the next month or so, I may have a beta version of a package
primarily providing helper functions for fitting SEM models, but could
also include an lm()ish wrapper to lavaan.  It would use the
traditional formula interface, but issue a warning if factor variables
or variables with insufficient unique values were used (as either
predictors or outcomes).  If anyone would be interested in beta
testing, feel free to email me.  Once I have a basic package working,
it will go up on github.

Cheers,

Josh
On Mon, Jul 23, 2012 at 6:07 AM, Andrew Miles <rstuff.miles at gmail.com> wrote: