Weird parameter estimates....

129 views
Skip to first unread message

Amanda Pollitt

unread,
Oct 29, 2013, 5:29:23 PM10/29/13
to lav...@googlegroups.com
So I'm attempting to replicate a longitudinal panel model that was also done in MPlus as our project is switching to R. (yay!) However, not only am I getting different numbers than the MPlus model, I'm getting out of bounds parameter estimates. Note that I can't correlate the residuals of w3access and w4ladder as they are not the same constructs.

Here is my code:

aim2.model <- '
  # measurement model.
    w3fin =~ NA*w3income + w3strain + w3access
    w4fin =~ w4income + w4strain + w4ladder
    w3alc =~ NA*w3alc1 + w3alc2 + w3ex1 + w3ex2
    w4alc =~ w4alc1 + w4alc2 + w4ex2 + w4ex2
  # regressions
    w4alc ~ w3alc + w3fin
    w4fin ~ w3alc + w3fin
  # residual correlations
    w3alc1 ~~ w4alc1
    w3alc2 ~~ w4alc2
    w3ex1 ~~ w4ex1
    w3ex2 ~~ w4ex2
    w3income ~~ w4income
    w3strain ~~ w4strain
    w3fin ~~ w3alc
    w3alc ~~ w4alc
    #constraining latent variance
    w3alc ~~ 1*w3alc
    w3fin ~~ 1*w3fin
'
fit3 <- sem(aim2.model, data = aim2model, missing = "ML")
summary(fit3, standardized = TRUE)

Here is the covariance matrix:
          w3incm w3strn w3ccss w4incm w4strn w4lddr w3alc1 w3alc2 w3ex1 w3ex2
w3inco   2.188                                                              
w3stra   0.000  0.035                                                       
w3acc   0.000  0.000  0.032                                                
w4inco   0.347  0.000  0.000  2.771                                         
w4stra   0.000  0.008  0.000  0.000  0.032                                  
w4ladd   0.000  0.000  0.000  0.000  0.000  2.155                           
w3alc1   0.000  0.000  0.000  0.000  0.000  0.000  0.918                    
w3alc2   0.000  0.000  0.000  0.000  0.000  0.000  0.000  7.244             
w3ex1    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.499      
w3ex2    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 0.481 
w4alc1   0.000  0.000  0.000  0.000  0.000  0.000  0.302  0.000  0.000 0.000 1.102
w4alc2   0.000  0.000  0.000  0.000  0.000  0.000  0.000  1.135  0.000 0.000 0.000  5.015
w4ex2    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 0.083 0.000  0.000  0.489
w4ex1    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.105 0.000 0.000  0.000  0.000 2.320


I thought that maybe this was an identification issue, but when I let it run with lavaan defaults it gives me even weirder estimates. Any clue where I might be making a mistake?

Thanks!
Amanda

Edward Rigdon

unread,
Oct 29, 2013, 9:15:16 PM10/29/13
to lav...@googlegroups.com
Amanda--
Are these two lines correct?

    w3alc =~ NA*w3alc1 + w3alc2 + w3ex1 + w3ex2
    w4alc =~ w4alc1 + w4alc2 + w4ex2 + w4ex2

In the second line, it looks like the same observed variable, w4ex2, appears twice.  Could that be part of your problem?
--Ed Rigdon 


--
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/groups/opt_out.

Amanda Pollitt

unread,
Oct 30, 2013, 12:04:20 PM10/30/13
to lav...@googlegroups.com
Good lord it's always something like that haha. I fixed the typo but I'm still getting an out of bounds parameter, here is the new matrix:

         w3incm w3strn w3ccss w4incm w4strn w4lddr w3alc1 w3alc2 w3ex1 w3ex2
w3inco   2.190                                                              
w3stra   0.000  0.035                                                       
w3acc   0.000  0.000  0.032                                                
w4inco   0.352  0.000  0.000  2.800                                         
w4stra   0.000  0.008  0.000  0.000  0.032                                  
w4ladd   0.000  0.000  0.000  0.000  0.000  2.147                           
w3alc1   0.000  0.000  0.000  0.000  0.000  0.000  0.927                    
w3alc2   0.000  0.000  0.000  0.000  0.000  0.000  0.000  7.252             
w3ex1    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.485      
w3ex2    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 0.483
w4alc1   0.000  0.000  0.000  0.000  0.000  0.000  0.311  0.000  0.000 0.000 1.222 
w4alc2   0.000  0.000  0.000  0.000  0.000  0.000  0.000  1.107  0.000 0.000 0.000  5.168
w4ex1    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.024 0.000 0.000  0.000  0.407
w4ex2    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 0.072 0.000  0.000  0.000 0.394

Thanks so much for the help!
Amanda

Edward Rigdon

unread,
Oct 30, 2013, 12:14:43 PM10/30/13
to lav...@googlegroups.com
How about these two lines, farther down:
 w3fin ~~ w3alc
 w3alc ~~ w4alc
The first of these seems to break the pattern that otherwise characterizes your syntax.
--Ed Rigdon

Terrence Jorgensen

unread,
Oct 30, 2013, 12:22:45 PM10/30/13
to lav...@googlegroups.com

I fixed the typo but I'm still getting an out of bounds parameter, here is the new matrix:

         w3incm w3strn w3ccss w4incm w4strn w4lddr w3alc1 w3alc2 w3ex1 w3ex2
w3inco   2.190                                                              
w3stra   0.000  0.035                                                       
w3acc   0.000  0.000  0.032                                                
w4inco   0.352  0.000  0.000  2.800                                         
w4stra   0.000  0.008  0.000  0.000  0.032                                  
w4ladd   0.000  0.000  0.000  0.000  0.000  2.147                           
w3alc1   0.000  0.000  0.000  0.000  0.000  0.000  0.927                    
w3alc2   0.000  0.000  0.000  0.000  0.000  0.000  0.000  7.252             
w3ex1    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.485      
w3ex2    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 0.483
w4alc1   0.000  0.000  0.000  0.000  0.000  0.000  0.311  0.000  0.000 0.000 1.222 
w4alc2   0.000  0.000  0.000  0.000  0.000  0.000  0.000  1.107  0.000 0.000 0.000  5.168
w4ex1    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.024 0.000 0.000  0.000  0.407
w4ex2    0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000 0.072 0.000  0.000  0.000 0.394


What out of bounds estimate are you talking about?  If this is the model-implied covariance matrix, you can't tell whether there are out of bounds estimates very easily -- try cov2cor() to turn it into a correlation matrix, and see if there are any values that exceed [1, -1].

If this is the sample covariance matrix, you can do the same cov2cor() check, but you might have out of bounds estimates because you have missing data, IF this sample matrix is estimated using pairwise deletion (instead of extracting the ML estimate from lavaan). 
 
If the correlations among your variables are as low as they seem from the covariance matrix, I wouldn't trust results from any package, unless you have a very large sample size and use more items to identify your constructs, in order to compensate for the low communalities (see attached article for advice).  But it's hard to tell whether this is a problem from your (unstandardized) covariance matrix.  It's also worth noting that you have some wildly different variances among the indicators within each construct (e.g., 2.8 vs. 0.03, or 7.25 vs. 0.48).  That can cause problems, so you might consider rescaling your variables in some way to make their variances more similar.  I don't have a specific guideline, but certainly the variables with more than 10 times, and some close to 100 times, greater variance than other indicators would be problematic (although I'm not sure it's related to why you get different numbers in the two packages).  

It's also possible you still aren't specifying the exact same model in both packages.  Have you checked your degrees of freedom and number of parameters being estimated?

MacCallumetal1999.pdf

Terrence Jorgensen

unread,
Oct 30, 2013, 12:25:42 PM10/30/13
to lav...@googlegroups.com

How about these two lines, farther down:
 w3fin ~~ w3alc
 w3alc ~~ w4alc
The first of these seems to break the pattern that otherwise characterizes your syntax.
--Ed Rigdon


Good eye, Ed, although I think it's the second of those that is inconsistent/problematic.  The "w4" variables are both regressed on both of the "w3" variables.  So the exogenous "w3" variables should be correlated, and the endogenous "w4" variables should be correlated.  But the line "w3alc ~~ w4alc" is specifying a covariance path where there is already a regression path: "w4alc ~ w3alc", so it's not identified.


Message has been deleted
Message has been deleted

Amanda Pollitt

unread,
Oct 31, 2013, 2:54:15 PM10/31/13
to lav...@googlegroups.com
Thanks for everyone's input. I've been staring at this code and feeling like I'm going crazy. I made the edit that Terrence suggested, so I figured I'd post the code and the output so you guys can see what's happening.

aim2.model <- '
  # measurement model
    w3fin =~ w3strain + w3access + w3income
    w4fin =~ w4strain + w4ladder + w4income
    w3alc =~ w3alc1 + w3alc2 + w3ex1 + w3ex2
    w4alc =~ w4alc1 + w4alc2 + w4ex1 + w4ex2
  # regressions
    w4alc ~ w3alc + w3fin
    w4fin ~ w3alc + w3fin
  # residual correlations
    w3alc1 ~~ w4alc1
    w3alc2 ~~ w4alc2
    w3ex1 ~~ w4ex1
    w3ex2 ~~ w4ex2
    w3income ~~ w4income
    w3strain ~~ w4strain
    w3alc ~~ w3fin
    w4fin ~~ w4alc
'
fit3 <- sem(aim2.model, data = niaaa, missing = "ML")
summary(fit3, standardized = TRUE)

Here you can see where I made the changes to the correlations.

lavaan (0.5-14) converged normally after 136 iterations

                                                  Used       Total
  Number of observations              17836       20747

  Number of missing patterns                       101

  Estimator                                         ML
  Minimum Function Test Statistic             2209.101
  Degrees of freedom                                65
  P-value (Chi-square)                           0.000

Parameter estimates:

  Information                                 Observed
  Standard Errors                             Standard

                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Latent variables:
  w3fin =~
    w3strain          1.000                               0.055    0.282
    w3access          3.671    0.185   19.840    0.000    0.201    0.749
    w3income         10.664    0.493   21.610    0.000    0.583    0.367
  w4fin =~
    w4strain          1.000                               0.110    0.522
    w4ladder          8.458    0.210   40.201    0.000    0.931    0.536
    w4income         13.009    0.342   38.055    0.000    1.432    0.650
  w3alc =~
    w3alc1            1.000                               1.465    0.836
    w3alc2            1.640    0.018   90.501    0.000    2.402    0.666
    w3ex1             0.947    0.007  133.918    0.000    1.387    0.894
    w3ex2             0.843    0.006  131.447    0.000    1.234    0.871
  w4alc =~
    w4alc1            1.000                               1.434    0.792
    w4alc2            1.381    0.016   86.804    0.000    1.980    0.657
    w4ex1             0.965    0.008  127.552    0.000    1.383    0.908
    w4ex2             0.801    0.006  123.974    0.000    1.148    0.878

Regressions:
  w4alc ~
    w3alc             0.527    0.009   59.388    0.000    0.538    0.538
    w3fin             0.045    0.273    0.166    0.868    0.002    0.002
  w4fin ~
    w3alc            -0.006    0.001   -6.573    0.000   -0.074   -0.074
    w3fin             1.417    0.055   25.871    0.000    0.704    0.704

Covariances:
  w3alc1 ~~
    w4alc1            0.311    0.012   26.443    0.000    0.311    0.292
  w3alc2 ~~
    w4alc2            1.107    0.058   18.959    0.000    1.107    0.181
  w3ex1 ~~
    w4ex1             0.024    0.007    3.598    0.000    0.024    0.054
  w3ex2 ~~
    w4ex2             0.072    0.006   13.039    0.000    0.072    0.166
  w3income ~~
    w4income          0.352    0.031   11.399    0.000    0.352    0.142
  w3strain ~~
    w4strain          0.008    0.000   24.269    0.000    0.008    0.249
  w3fin ~~
    w3alc            -0.010    0.001  -10.272    0.000   -0.127   -0.127
  w4fin ~~
    w4alc            -0.006    0.001   -4.139    0.000   -0.065   -0.065

Intercepts:
    w3strain          0.099    0.002   63.219    0.000    0.099    0.510
    w3access          0.445    0.002  206.830    0.000    0.445    1.660
    w3income          6.622    0.013  500.272    0.000    6.622    4.163
    w4strain          0.124    0.002   74.183    0.000    0.124    0.587
    w4ladder          5.978    0.014  433.207    0.000    5.978    3.444
    w4income          4.606    0.018  259.152    0.000    4.606    2.092
    w3alc1            2.131    0.014  152.157    0.000    2.131    1.216
    w3alc2            3.203    0.029  110.230    0.000    3.203    0.888
    w3ex1             1.158    0.012   93.352    0.000    1.158    0.746
    w3ex2             1.093    0.011   96.487    0.000    1.093    0.771
    w4alc1            2.215    0.014  155.152    0.000    2.215    1.224
    w4alc2            2.662    0.024  111.229    0.000    2.662    0.883
    w4ex1             1.118    0.012   93.104    0.000    1.118    0.734
    w4ex2             0.958    0.010   92.820    0.000    0.958    0.732
    w3fin             0.000                               0.000    0.000
    w4fin             0.000                               0.000    0.000
    w3alc             0.000                               0.000    0.000
    w4alc             0.000                               0.000    0.000

Variances:
    w3strain          0.035    0.000                      0.035    0.920
    w3access          0.032    0.002                      0.032    0.440
    w3income          2.190    0.029                      2.190    0.865
    w4strain          0.032    0.000                      0.032    0.728
    w4ladder          2.147    0.032                      2.147    0.712
    w4income          2.800    0.057                      2.800    0.577
    w3alc1            0.927    0.014                      0.927    0.302
    w3alc2            7.252    0.091                      7.252    0.557
    w3ex1             0.485    0.009                      0.485    0.202
    w3ex2             0.483    0.008                      0.483    0.240
    w4alc1            1.222    0.017                      1.222    0.373
    w4alc2            5.168    0.063                      5.168    0.569
    w4ex1             0.407    0.009                      0.407    0.175
    w4ex2             0.394    0.007                      0.394    0.230
    w3fin             0.003    0.000                      1.000    1.000
    w4fin             0.006    0.000                      0.485    0.485
    w3alc             2.146    0.035                      1.000    1.000
    w4alc             1.460    0.026                      0.711    0.711

The regressions are where I'm concerned. I'm getting a value over 1 there with standardized output. You can also see that my sample is very large and I'm using ML for missing data. Thank you so much for the help.

Terrence Jorgensen

unread,
Oct 31, 2013, 4:39:47 PM10/31/13
to lav...@googlegroups.com

                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Regressions:
  w4alc ~
    w3alc             0.527    0.009   59.388    0.000    0.538    0.538
    w3fin             0.045    0.273    0.166    0.868    0.002    0.002
  w4fin ~
    w3alc            -0.006    0.001   -6.573    0.000   -0.074   -0.074
    w3fin             1.417    0.055   25.871    0.000    0.704    0.704
The regressions are where I'm concerned. I'm getting a value over 1 there with standardized output.


I'm not seeing any out-of-bounds estimates, anywhere in your output.  When you request standardized results using "summary(fit3, standardized = TRUE)", you will get unstandardized results under the first column (labeled "Estimate"), estimates where only the latent variables are standardized in the 5th column (labeled "Std.lv"), and estimates where both the latent and observed variables are standardized (labeled "Std.all").  For comparison, see the results for excluding the "standardized" argument: summary(fit3).

So the regression parameter that is 1.417 is not out of bounds because it is not standardized.  The standardized solution for this estimate, and for all estimates in your model, are within bounds (see the far right column).

Terry

Edward Rigdon

unread,
Oct 31, 2013, 6:46:38 PM10/31/13
to lav...@googlegroups.com
Collinearity can drive standardized regression coefficients beyond +/- 1.0, as can marginal identification problems (which are somewhat the same thing) and misspecification.  How severe is Collinearity among predictor sets?
--Ed Rigdon

Sent from my iPad

On Oct 31, 2013, at 2:30 PM, Amanda Pollitt <ampoll...@gmail.com> wrote:

No -- just kidding. I followed what Terrence says so here is the new code:

model2 <- '
  # measurement model
w1alc =~ NA*h1to15 + h1to16 + h1to17 + h1to18
w2alc =~ h2to19 + h2to20 + h2to21 + h2to22
w3alc =~ w3alc1 + w3alc2 + w3ex1 + w3ex2
w4alc =~ w4alc1 + w4alc2 + w4ex1 + w4ex2
w3fin =~ NA*w3strain + w3access + w3income
w4fin =~ w4strain + w4ladder + w4income
# regressions
w2alc ~ w1alc
w3alc ~ w2alc
w4alc ~ w3alc + w3fin
w4fin ~ w3alc + w3fin
# residual correlations
w3strain ~~ w4strain
w3income ~~ w4income
h1to15 ~~ h2to19
w3alc1 ~~ w4alc1
h1to16 ~~ h2to20
w3alc2 ~~ w4alc2
h1to17 ~~ h2to21
w3ex1 ~~ w4ex1
h1to18 ~~ h2to22
w3ex2 ~~ w4ex2
w3alc ~~ w3fin
w4alc ~~ w4fin
w1alc ~~ 1*w1alc                  
w3fin ~~ 1*w3fin
'
And here is my regression output:

Regressions:
  w4alc ~
    w3alc             0.768    2.499    0.308    0.758    0.536    0.536
    w3fin            -0.021   19.665   -0.001    0.999   -0.015   -0.015
  w4fin ~
    w3alc            -0.123       NA                     -0.086   -0.086
    w3fin             1.006       NA                      0.703    0.703

Ugh.
Amanda

On Thursday, October 31, 2013 11:22:52 AM UTC-7, Amanda Pollitt wrote:
Ed -- Great! So that was the problem. Thank you for catching my typos. It should read w3fin ~~ w4fin. Fixed that, and things look like they should. 

Terrence -- Thank you for your advice. We do have a sample of 20,747 but I'll bring the scaling information to the project group as I think that's a valid concern. When I meant out of bounds parameter estimates, I meant regression coefficients -- I was getting values over 1 in my standardized output.

So although this fixed MY problem, I'm still getting differences from MPlus. I went back and checked and it looks like MPlus doesn't constrain one of the factor loadings in the standardized output like lavaan doesp; it constrains them only in unstandardized output. I don't expect anyone here to know MPlus since this is a lavaan board, but it's certainly weird. I think that's where the differences lie.

But either way, thank you for solving my problem!!

Amanda


On Wednesday, October 30, 2013 9:25:42 AM UTC-7, Terrence Jorgensen wrote:
Reply all
Reply to author
Forward
0 new messages