issues with a two-stage cfa model from the semTools package

151 views
Skip to first unread message

favstats

unread,
Aug 1, 2017, 6:19:16 PM8/1/17
to lavaan
Hello everyone,

I recently discovered the twostage() function which does exactly what I would need for my analysis. Unfortunately, I can't seem to make it adopt robust hubert white standard errors. So I specify the following model:


out1 <- cfa.2stage(model = model,
                   data
= logbat,
                   aux
= c("age","sex"),
                   se
= "robust.huber.white")
summary
(out1@target, standardized = TRUE)

it gives me this output

Parameter Estimates:

  Information                                 Observed
  Standard Errors                             Standard

Don't really understand what I am doing wrong here.

In the description of the function it says:

The summary function prints the same information from the show method, but also provides (and returns) the output of parameterEstimates(object@target, ...) with corrected SEs, test statistics, and confidence intervals (semTools p.137)

Also here are two questions which I am trying to understand:

The description of the function also says this: 

The twostage object contains 3 fitted lavaan models (saturated, target/hypothesized, and baseline) as well as the names of auxiliary variables. None of the individual models provide the correct model results (except the point estimates in the target model are unbiased). Use the methods in twostage to extract corrected SEs and test statistics.

1) So which methods do I exactly use to get the "correct" model results?
2)  If I call the following fitmeasures function

fitmeasures(out1@target)
               npar                fmin               chisq 
             25.000               0.034             236.370 
                 df              pvalue      baseline.chisq 
             19.000               0.000            6595.360 
        baseline.df     baseline.pvalue                 cfi 
             28.000               0.000               0.967 
                tli                nnfi                 rfi 
              0.951               0.951               0.947 
                nfi                pnfi                 ifi 
              0.964               0.654               0.967 
                rni                logl   unrestricted.logl 
              0.967          -39421.822          -39303.637 
                aic                 bic              ntotal 
          78893.643           79047.585            3490.000 
               bic2               rmsea      rmsea.ci.lower 
          78968.148               0.057               0.051 
     rmsea.ci.upper        rmsea.pvalue                 rmr 
              0.064               0.031               0.091 
         rmr_nomean                srmr        srmr_bentler 
              0.091               0.043               0.043 
srmr_bentler_nomean         srmr_bollen  srmr_bollen_nomean 
              0.048               0.043               0.048 
         srmr_mplus   srmr_mplus_nomean               cn_05 
              0.043               0.048             446.069 
              cn_01                 gfi                agfi 
            535.358               0.999               0.998 
               pgfi                 mfi                ecvi 
              0.431               0.969                  NA 

does it give me reliable output? Because it does look like it would give me reliable output!

Terrence Jorgensen

unread,
Aug 6, 2017, 1:41:06 PM8/6/17
to lavaan
I can't seem to make it adopt robust hubert white standard errors. 

The robust SEs are applied in the first stage, when the saturated model is fit to the raw incomplete data.  In the second stage, only the model parameters are estimated, by fitting the target model to the model-implied covariance matrix and mean vector from Stage 1.  That is why there is no way to apply robust SEs in Stage 2.  The information about nonnormality from the robust corrections derived in Stage 1 are used to correct the naïve SEs in Stage 2.

does it give me reliable output?

No, you should not be applying lavaan methods to the individual lavaan objects from Stages 1 or 2.  See the class?twostage help page for available methods to apply to the output of twostage().  In other words, don't use summary(out1@target), use summary(out1).  The fit statistic (no indices yet) is available from anova(out1), not fitMeasures(out1@target), but the scaled statistic is too high.  Haven't been able to locate a bug or miscalculation yet, but when comparing the scaled statistic to the residual-based one (only available when data are assumed normal) and to FIML output, it is obvious that the residual-based statistic is executed correctly, whereas the scaled statistic is inflated (because the estimated scaling factor is too small).

Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Message has been deleted

Nikki M

unread,
Jan 13, 2019, 4:37:14 PM1/13/19
to lavaan
I am trying to find code for the twostage CFA-  but am having difficulty finding the actual code. I have predictors in a CFA that are skewed. Needing to use robust standard errors (an then will test factorial invariance). I've read to either use robust maximum likelihood estimation with the Satorra-Bentler chi-square correction  or   se = robust.huber.white '
I thought the huber white was preferred, because we have some missing data with a large sample

The thread in this post says the se = robust.huber.white ' needs to be in the first stage of the CFA. 
What is the frist stage? I can't find the help page- 

Or I found another reference that suggests using MLM mimic Mplus, but the results of the CFA still say the standard errors are "standard" not robust. Still trying to figure this out.

HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6'
fit <- cfa(HS.model, data=HolzingerSwineford1939, missing = "listwise",
           + estimator = 'MLM', mimic = 'Mplus')
summary(fit, fit.measures = TRUE)

Thanks!
- show quoted text -

Terrence Jorgensen

unread,
Jan 15, 2019, 7:47:00 AM1/15/19
to lavaan
I am trying to find code for the twostage CFA-  but am having difficulty finding the actual code.

Find examples on the help page:

?semTools::twostage


Actually, lavaan implements this method internally now (but now with auxiliary variables), so you do not need the semTools function.  See the ?lavOptions help page to find the options for the missing= argument.

fit <- cfa(HS.model, data=HolzingerSwineford1939, missing = "robust.two.stage")



I've read to either use robust maximum likelihood estimation with the Satorra-Bentler chi-square correction  or   se = robust.huber.white '
I thought the huber white was preferred, because we have some missing data with a large sample

Yes, that option is set using estimator="MLR" (asymptotically equivalent to MLM, but works with incomplete data).  But if you want 2-stage SEM, setting the missing="robust.two.stage" argument will automatically set the se= and test= arguments to be robust.


Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Ibrahim Nasser

unread,
Sep 8, 2019, 3:46:25 PM9/8/19
to lavaan
Does that mean that fit indices are reliable using lavaan with missing="robust.two.stage"?

Terrence Jorgensen

unread,
Sep 9, 2019, 7:02:24 AM9/9/19
to lavaan
Does that mean that fit indices are reliable using lavaan with missing="robust.two.stage"?

It means that robust SEs and test statistics will be calculated, which should have nominal error rates even if data are (continuous but) not normal.
Reply all
Reply to author
Forward
0 new messages