How can I get residual correlations for a nonrecursive model with both continuous and binary endogenous variables?

112 views
Skip to first unread message

Timothy Kim

unread,
Mar 16, 2020, 10:17:00 PM3/16/20
to lavaan
Hello, 

I am trying to identify and estimate a complex nonrecursive model where I have three endogenous variables: EV1, EV2 and EV3. There are feedback relationships between EV1 and EV2, between EV2 and EV3 and between EV1 and EV3. There are also instrumental variables for each of the three endogenous variables to identify the nonrecursive model. I also have a set of exogenous variables predicting different endogenous variables. Most or all of my exogenous variables (including instrumental variables) are categorical or binary. EV1 and EV2 are both continuous endogenous variables. EV3 is a binary endogenous variable. Lastly, all three error terms of the three endogenous variables are specified to correlate (in all possible pairs: error1 with error2; error1 with error3 and error2 with error3).

When I run the Lavaan Diagonally-weighted Least Squares and try to look at the residual correlations by using the "residual(fit, type = "cor")" command afterwards, I get something like the following outputs (Below are not actual values. Values are made up here only for the purposes of this example. However, they look very similar to the real output values): 



residuals(fit.model, type = "cor")
$type
[1] "cor.bollen"

$res.cov
              EV1    EV2    EV3
EV1      0.000              
EV2      0.002  0.000       
EV3     -0.024 -0.031  0.000

       EV1         EV2         EV3 
      0.000       0.000       3.736 

EV3  |t1 
             0 

$res.slopes
                V1     V2       V3       V4       V5      V6    V7    V8   V9   V10    V11    V12
EV1     -0.018  0.110 -0.100 -0.042 -0.044     0      0      0      0 -0.042 -0.030  0.024
EV2      0.069 -0.033  0.025 -0.088  0.022     0      0      0      0  0.008 -0.065  0.115
EV3     -0.050  0.010 -0.010  0.011 -0.001     0      0      0      0 -0.002 -0.004 -0.018

$cov.x
             V1    V2     V3   V4   V5  V6   V7   V8     V9    V10   V11   V12
V1           0                                                                               
V2           0      0                                                                        
V3           0      0      0                                                                 
V4           0      0      0      0                                                          
V5           0      0      0      0    0                                                     
V6           0      0      0      0    0      0                                              
V7           0      0      0      0    0      0     0                                        
V8           0      0      0      0    0      0     0      0                                 
V9           0      0      0      0    0      0     0      0      0                          
V10          0      0      0      0    0      0     0      0      0      0                   
V11          0      0      0      0    0      0     0      0      0      0      0            
V12          0      0      0      0    0      0     0      0      0      0      0      0     

$mean.x
          V1         V2          V3          V4         V5          V6          V7         V8          V9        V10        V11       V12 
           0            0            0            0            0            0            0            0            0            0            0            0 



I am not sure what those shortened labels ($res.cov, $res.int, $res.th, $res.slopes, $cov.x, $mean.x) are indicating exactly. Is "$res.slopes" what I am looking at in terms of residual correlations (paying closer attention to those significantly greater than the absolute value of 0.1)? Is it possible to do residual correlations with categorical endogenous variables (in my case, binary endogenous variable)?



Also, I am getting 0 values for $cov.x and $mean.x (all the values in the lower triangle matrix are 0). What is the output indicating here?



Thank you very much!!




Timothy Kim

unread,
Mar 19, 2020, 4:44:33 PM3/19/20
to lavaan
Dear Dr. Yves Rosseel, 

Could you perhaps clarify what the following labels are indicating, when running nonrecursive models with both continuous and binary endogenous variables (diagonally weighted least squares): 


$res.cov, $res.int, $res.th, $res.slopes, $cov.x, $mean.x


Are both $res.cov and $res.slopes what I am looking at to assess standardized residual correlations (those greater than 0.1 warranting closer attention)?


Your clarification would be very helpful! 

Thank you. 

Terrence Jorgensen

unread,
Mar 21, 2020, 11:41:37 AM3/21/20
to lavaan
Could you perhaps clarify what the following labels are indicating, when running nonrecursive models with both continuous and binary endogenous variables (diagonally weighted least squares): 
 

$res.cov, $res.int, $res.th, $res.slopes, $cov.x, $mean.x


Nothing to do with nonrecursive models.  By default, lavaan partials out exogenous effects when estimating polychoric correlations, to assuage the computational instabilities involved with DWLS.  Thus, your model is fitted to the residual polychorics, intercepts, etc., given the exogenous variables in your model.

res.slopes contains the exogenous effects, and cov.x & mean.x are the sample moments of the exogenous variables.

Are both $res.cov and $res.slopes what I am looking at to assess standardized residual correlations (those greater than 0.1 warranting closer attention)?

Not necessarily.  The interpretation of residuals gets very complicated, especially if your hypothesized model does not estimate all possible effects of exogenous variables on each of the endogenous variables.  To get back to familiar territory, you could simply set conditional.x=FALSE and interpret the usual standardized residuals.

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

Timothy Kim

unread,
Mar 26, 2020, 10:47:04 AM3/26/20
to lavaan
Dear Terrence Jorgensen, 

Thank you very much for your helpful reply. 

So to clarify, do I set conditional.x=FALSE and manually specify covariances and variances among my exogenous variables, in order to get residual correlations with the "residuals(fit.model, type = "cor")" command? 

I want to be able to see if any of my residual correlations exceed the absolute value of 0.1 to get an idea of how good the "local fit" is. Would I get residual correlations only when I set conditional.x=FALSE and do not specify anything else among my exogenous variables? 

Also, can residual correlations be obtained with the diagonally-weighted least squares? Or is it only possible with maximum likelihood estimation? 

Thank you very much!

Terrence Jorgensen

unread,
Apr 9, 2020, 8:43:01 AM4/9/20
to lavaan
So to clarify, do I set conditional.x=FALSE 

Yes
 
manually specify covariances and variances among my exogenous variables

That is not necessary
 
in order to get residual correlations with the "residuals(fit.model, type = "cor")" command? 

Yes, then they (the correlation residuals) will have the interpretation you are used to.
 
can residual correlations be obtained with the diagonally-weighted least squares?

Yes (again, correlation residuals; residual correlations are standardized estimates of residual covariances between endogenous variables in Theta or Psi)

Emma Scandolo

unread,
Dec 12, 2024, 5:49:27 AM12/12/24
to lavaan
Hi both, 

I have a follow-up question related to the topic of this conversation. I am trying to figure how exactly the $res.slopes vector is estimated. I understand that the $res.th vector contains the intercepts of the probit model where we regress the measure on the covariate, but I am not able to understand how the $res.slope is estimated. Any advice would be great!

Thank you,
Emma

Yves Rosseel

unread,
Jan 3, 2025, 6:58:17 AM1/3/25
to lav...@googlegroups.com
On 12/12/24 11:49, 'Emma Scandolo' via lavaan wrote:
> I have a follow-up question related to the topic of this conversation. I
> am trying to figure how exactly the $res.slopes vector is estimated.

This only happens if you have exogenous covariates in your model. Vy By
default, lavaan then switches to 'conditional.x = TRUE' mode, and lavaan
will first regress out all those covariates from the endogenous
variables, before computing the thresholds and (now residual)
correlations. This is done by a series of probit regressions (one for
each dependent ordered variable), and the resulting regression
coefficients are the rows in $res.slopes.

Yves.
Reply all
Reply to author
Forward
0 new messages