parameterEstimates: std.lv vs std.all

1,252 views
Skip to first unread message

Mark Seeto

unread,
Jan 13, 2015, 5:01:34 PM1/13/15
to lav...@googlegroups.com
Dear lavaan group,

I'm having trouble understanding why the std.lv and std.all estimates for a certain parameter are the same.

In the following example, I have an exogenous observed variable x4, an exogenous latent variable F1 (indicators x1,x2,x3), and an endogenous latent variable F2 (indicators x5,x6,x7).

library(lavaan)
library(mvtnorm)

set.seed(1)

n <- 10000  # sample size

rho <- 0.7  # correlation between F1 and x4

var.F1 <- 1  # variance of F1
var.x4 <- 3  # variance of x4

cov.F1x4 <- rho*sqrt(var.F1*var.x4)  # Covariance between F1 and x4 = 1.212

# First column of D is F1, second column is x4
D <- rmvnorm(n, mean = c(0, 0),
             sigma = matrix(c(var.F1, cov.F1x4, cov.F1x4, var.x4), nrow=2))

beta1 <- 0.5  # F2 ~ F1 coefficient
beta2 <- 0.3  # F2 ~ x4 coefficient

var.resF2 <- 1 - (beta1^2 + beta2^2*var.x4 + 2*beta1*beta2*cov.F1x4)  # F2 residual variance = 0.116

F2 <- beta1*D[, 1] + beta2*D[, 2] + rnorm(n, 0, sqrt(var.resF2))

# Indicator loadings
L1 <- 0.9
L2 <- 0.6
L3 <- 1.3
L5 <- 1.1
L6 <- 0.8
L7 <- 0.5

# Indicator residual variances
var1 <- 0.4
var2 <- 0.3
var3 <- 0.4
var5 <- 0.3
var6 <- 0.3
var7 <- 0.2

d <- data.frame(x1 = L1*D[, 1] + rnorm(n, 0, sqrt(var1)),
                x2 = L2*D[, 1] + rnorm(n, 0, sqrt(var2)),
                x3 = L3*D[, 1] + rnorm(n, 0, sqrt(var3)),
                x4 = D[, 2],
                x5 = L5*F2 + rnorm(n, 0, sqrt(var5)),
                x6 = L6*F2 + rnorm(n, 0, sqrt(var6)),
                x7 = L7*F2 + rnorm(n, 0, sqrt(var7)))

mod <- '
F1 =~ x1 + x2 + x3
F2 =~ x5 + x6 + x7
F2 ~ F1 + x4
F1 ~~ x4
'

# Use fixed.x=FALSE to allow F1~~x4
sem1 <- sem(mod, data=d, estimator="MLR", fixed.x=FALSE, std.lv=TRUE)


> parameterEstimates(sem1, standardized=TRUE)
   lhs op rhs    est    se       z pvalue ci.lower ci.upper std.lv std.all std.nox
1   F1 =~  x1  0.911 0.009  99.498  0.000    0.893    0.929  0.911   0.823   0.823
2   F1 =~  x2  0.596 0.007  84.043  0.000    0.582    0.610  0.596   0.730   0.730
3   F1 =~  x3  1.310 0.011 114.069  0.000    1.287    1.332  1.310   0.900   0.900
4   F2 =~  x5  0.382 0.007  52.516  0.000    0.368    0.396  1.100   0.896   0.896
5   F2 =~  x6  0.276 0.005  52.192  0.000    0.266    0.287  0.797   0.821   0.821
6   F2 =~  x7  0.173 0.003  50.240  0.000    0.167    0.180  0.500   0.745   0.745
7   F2  ~  F1  1.438 0.041  35.467  0.000    1.358    1.517  0.499   0.499   0.499
8   F2  ~  x4  0.862 0.019  45.240  0.000    0.825    0.900  0.299   0.516   0.516
9   F1 ~~  x4  1.220 0.016  78.189  0.000    1.190    1.251  1.220   1.220   1.220
10  x1 ~~  x1  0.395 0.007  54.629  0.000    0.381    0.409  0.395   0.323   0.323
11  x2 ~~  x2  0.311 0.005  60.882  0.000    0.301    0.321  0.311   0.467   0.467
12  x3 ~~  x3  0.402 0.011  36.752  0.000    0.380    0.423  0.402   0.190   0.190
13  x5 ~~  x5  0.297 0.006  46.043  0.000    0.284    0.309  0.297   0.197   0.197
14  x6 ~~  x6  0.308 0.005  59.827  0.000    0.298    0.318  0.308   0.327   0.327
15  x7 ~~  x7  0.200 0.003  63.249  0.000    0.194    0.206  0.200   0.444   0.444
16  x4 ~~  x4  2.972 0.042  69.953  0.000    2.889    3.055  2.972   1.000   1.000
17  F1 ~~  F1  1.000 0.000      NA     NA    1.000    1.000  1.000   1.000   1.000
18  F2 ~~  F2  1.000 0.000      NA     NA    1.000    1.000  0.120   0.120   0.120
19  x1 ~1     -0.014 0.011  -1.293  0.196   -0.036    0.007 -0.014  -0.013  -0.013
20  x2 ~1     -0.009 0.008  -1.116  0.264   -0.025    0.007 -0.009  -0.011  -0.011
21  x3 ~1     -0.022 0.015  -1.508  0.132   -0.050    0.007 -0.022  -0.015  -0.015
22  x5 ~1     -0.009 0.009  -1.005  0.315   -0.026    0.008 -0.009  -0.007  -0.007
23  x6 ~1      0.004 0.007   0.602  0.547   -0.010    0.019  0.004   0.005   0.005
24  x7 ~1     -0.005 0.005  -0.927  0.354   -0.016    0.006 -0.005  -0.007  -0.007
25  x4 ~1      0.003 0.017   0.145  0.885   -0.031    0.036  0.003   0.001   0.001
26  F1 ~1      0.000 0.000      NA     NA    0.000    0.000  0.000   0.000   0.000
27  F2 ~1      0.000 0.000      NA     NA    0.000    0.000  0.000   0.000   0.000


I don't understand why F1~~x4 has the same value in the std.lv and std.all columns. I would have expected that the std.all value would be scaled down by the standard deviation of x4. Could someone please explain?

Thanks,
Mark



Mark Seeto

unread,
Jan 15, 2015, 2:31:33 PM1/15/15
to lav...@googlegroups.com
And an additional question: why does x4~~x4 have the value 1 in the std.nox column? I would have thought it should have stayed at 2.972.

Thanks,
Mark

Yves Rosseel

unread,
Jan 16, 2015, 4:37:29 AM1/16/15
to lav...@googlegroups.com
> I don't understand why F1~~x4 has the same value in the std.lv and
> std.all columns. I would have expected that the std.all value would be
> scaled down by the standard deviation of x4.

I believe you are right. This looks like a bug. After looking at the
source code, I now realize that lavaan does not handle this correctly
for the specific case 'lv ~~ ov' (ie: lhs is a factor, rhs is an
observed variable).

This is now fixed in dev 0.5-18.768

Thanks for reporting this!

Yves.

Yves Rosseel

unread,
Jan 16, 2015, 4:39:23 AM1/16/15
to lav...@googlegroups.com
On 01/15/2015 08:31 PM, Mark Seeto wrote:
> And an additional question: why does x4~~x4 have the value 1 in the
> std.nox column? I would have thought it should have stayed at 2.972.

This is direct consequence of the fixed.x = FALSE flag. x4 is no longer
considered as a 'true' exogenous covariate any longer.

Yves.

Mark Seeto

unread,
Jan 16, 2015, 5:56:19 AM1/16/15
to lav...@googlegroups.com
Thanks for your replies Yves.

Mark Seeto

unread,
Jan 18, 2015, 3:47:06 PM1/18/15
to lav...@googlegroups.com
I have a related question about this.

I had assumed (perhaps incorrectly) that if I planned to use the std.lv column or the std.all column from parameterEstimates, then it would not make any difference whether I had "std.lv=TRUE" in the call to the sem function.

However, using the same example as above, if we do

sem1 <- sem(mod, data=d, estimator="MLR", fixed.x=FALSE, std.lv=TRUE)

sem2 <- sem(mod, data=d, estimator="MLR", fixed.x=FALSE)

then we get

> parameterEstimates(sem1, standardized=TRUE)
   lhs op rhs    est    se       z pvalue ci.lower ci.upper std.lv std.all std.nox
1   F1 =~  x1  0.911 0.009  99.498  0.000    0.893    0.929  0.911   0.823   0.823
2   F1 =~  x2  0.596 0.007  84.043  0.000    0.582    0.610  0.596   0.730   0.730
3   F1 =~  x3  1.310 0.011 114.069  0.000    1.287    1.332  1.310   0.900   0.900
4   F2 =~  x5  0.382 0.007  52.516  0.000    0.368    0.396  1.100   0.896   0.896
5   F2 =~  x6  0.276 0.005  52.192  0.000    0.266    0.287  0.797   0.821   0.821
6   F2 =~  x7  0.173 0.003  50.240  0.000    0.167    0.180  0.500   0.745   0.745
7   F2  ~  F1  1.438 0.041  35.467  0.000    1.358    1.517  0.499   0.499   0.499
8   F2  ~  x4  0.862 0.019  45.240  0.000    0.825    0.900  0.299   0.516   0.516
9   F1 ~~  x4  1.220 0.016  78.189  0.000    1.190    1.251  1.220   0.708   0.708
10  x1 ~~  x1  0.395 0.007  54.629  0.000    0.381    0.409  0.395   0.323   0.323
11  x2 ~~  x2  0.311 0.005  60.882  0.000    0.301    0.321  0.311   0.467   0.467
12  x3 ~~  x3  0.402 0.011  36.752  0.000    0.380    0.423  0.402   0.190   0.190
13  x5 ~~  x5  0.297 0.006  46.043  0.000    0.284    0.309  0.297   0.197   0.197
14  x6 ~~  x6  0.308 0.005  59.827  0.000    0.298    0.318  0.308   0.327   0.327
15  x7 ~~  x7  0.200 0.003  63.249  0.000    0.194    0.206  0.200   0.444   0.444
16  x4 ~~  x4  2.972 0.042  69.953  0.000    2.889    3.055  2.972   1.000   1.000
17  F1 ~~  F1  1.000 0.000      NA     NA    1.000    1.000  1.000   1.000   1.000
18  F2 ~~  F2  1.000 0.000      NA     NA    1.000    1.000  0.120   0.120   0.120
19  x1 ~1     -0.014 0.011  -1.293  0.196   -0.036    0.007 -0.014  -0.013  -0.013
20  x2 ~1     -0.009 0.008  -1.116  0.264   -0.025    0.007 -0.009  -0.011  -0.011
21  x3 ~1     -0.022 0.015  -1.508  0.132   -0.050    0.007 -0.022  -0.015  -0.015
22  x5 ~1     -0.009 0.009  -1.005  0.315   -0.026    0.008 -0.009  -0.007  -0.007
23  x6 ~1      0.004 0.007   0.602  0.547   -0.010    0.019  0.004   0.005   0.005
24  x7 ~1     -0.005 0.005  -0.927  0.354   -0.016    0.006 -0.005  -0.007  -0.007
25  x4 ~1      0.003 0.017   0.145  0.885   -0.031    0.036  0.003   0.001   0.001
26  F1 ~1      0.000 0.000      NA     NA    0.000    0.000  0.000   0.000   0.000
27  F2 ~1      0.000 0.000      NA     NA    0.000    0.000  0.000   0.000   0.000

> parameterEstimates(sem2, standardized=TRUE)
   lhs op rhs    est    se       z pvalue ci.lower ci.upper std.lv std.all std.nox
1   F1 =~  x1  1.000 0.000      NA     NA    1.000    1.000  0.911   0.823   0.823
2   F1 =~  x2  0.655 0.008  81.626  0.000    0.639    0.670  0.596   0.730   0.730
3   F1 =~  x3  1.438 0.014 105.338  0.000    1.411    1.465  1.310   0.900   0.900
4   F2 =~  x5  1.000 0.000      NA     NA    1.000    1.000  1.100   0.896   0.896
5   F2 =~  x6  0.724 0.007 107.640  0.000    0.711    0.737  0.797   0.821   0.821
6   F2 =~  x7  0.454 0.005  93.391  0.000    0.445    0.464  0.500   0.745   0.745
7   F2  ~  F1  0.603 0.011  53.528  0.000    0.581    0.625  0.499   0.499   0.499
8   F2  ~  x4  0.329 0.005  61.823  0.000    0.319    0.340  0.299   0.516   0.516
9   F1 ~~  x4  1.112 0.021  52.810  0.000    1.070    1.153  1.112   0.645   0.645
10  x1 ~~  x1  0.395 0.007  54.629  0.000    0.381    0.409  0.395   0.323   0.323
11  x2 ~~  x2  0.311 0.005  60.882  0.000    0.301    0.321  0.311   0.467   0.467
12  x3 ~~  x3  0.402 0.011  36.752  0.000    0.380    0.423  0.402   0.190   0.190
13  x5 ~~  x5  0.297 0.006  46.043  0.000    0.284    0.309  0.297   0.197   0.197
14  x6 ~~  x6  0.308 0.005  59.827  0.000    0.298    0.318  0.308   0.327   0.327
15  x7 ~~  x7  0.200 0.003  63.249  0.000    0.194    0.206  0.200   0.444   0.444
16  x4 ~~  x4  2.972 0.042  69.953  0.000    2.889    3.055  2.972   1.000   1.000
17  F1 ~~  F1  0.830 0.017  49.749  0.000    0.797    0.862  1.000   1.000   1.000
18  F2 ~~  F2  0.146 0.006  26.258  0.000    0.135    0.157  0.120   0.120   0.120
19  x1 ~1     -0.014 0.011  -1.293  0.196   -0.036    0.007 -0.014  -0.013  -0.013
20  x2 ~1     -0.009 0.008  -1.116  0.264   -0.025    0.007 -0.009  -0.011  -0.011
21  x3 ~1     -0.022 0.015  -1.508  0.132   -0.050    0.007 -0.022  -0.015  -0.015
22  x5 ~1     -0.009 0.009  -1.005  0.315   -0.026    0.008 -0.009  -0.007  -0.007
23  x6 ~1      0.004 0.007   0.602  0.547   -0.010    0.019  0.004   0.005   0.005
24  x7 ~1     -0.005 0.005  -0.927  0.354   -0.016    0.006 -0.005  -0.007  -0.007
25  x4 ~1      0.002 0.017   0.145  0.885   -0.031    0.036  0.002   0.001   0.001
26  F1 ~1      0.000 0.000      NA     NA    0.000    0.000  0.000   0.000   0.000
27  F2 ~1      0.000 0.000      NA     NA    0.000    0.000  0.000   0.000   0.000

In the std.lv and std.all columns, the F1~~x4 line is different for sem1 and sem2. Is this expected? (This is using version 0.5-18.770.)

Thanks,
Mark

Edward Rigdon

unread,
Jan 18, 2015, 8:45:22 PM1/18/15
to lav...@googlegroups.com

Std.lv = true potentially imposes meaningful constraints on the model.  If you have scaled a factor  by fixing a loading to 1 (which forces the factor’s variance to be equal to indicator variance minus residual variance), then standardizing the factor forces the factor’s variance to equal 1, which may be inconsistent.  With reference variables specified, std.lv = True should have provided 2 more DF and a different fit.  If you remove the constraints on loadings, the two sets of results may be more similar.

--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/d/optout.

Mark Seeto

unread,
Jan 19, 2015, 2:56:52 PM1/19/15
to lav...@googlegroups.com
Thanks for your reply Ed, but the df and test statistics for the two fits are the same:

> sem1
lavaan (0.5-18.770) converged normally after  40 iterations

  Number of observations                         10000

  Estimator                                         ML      Robust
  Minimum Function Test Statistic               12.288      12.328
  Degrees of freedom                                12          12
  P-value (Chi-square)                           0.423       0.420
  Scaling correction factor                                  0.997
    for the Yuan-Bentler correction

> sem2
lavaan (0.5-18.770) converged normally after  39 iterations

  Number of observations                         10000

  Estimator                                         ML      Robust
  Minimum Function Test Statistic               12.288      12.328
  Degrees of freedom                                12          12
  P-value (Chi-square)                           0.423       0.420
  Scaling correction factor                                  0.997
    for the Yuan-Bentler correction

Note that I'm asking about the std.lv and std.all columns in the parameterEstimates tables. I expected the std.lv column for sem1 to be the same as the std.lv column for sem2, and I expected the std.all column for sem1 to be the same as the std.all column for sem2. They are the same for all parameters except for F1~~x4, and I'm wondering why they're different for that parameter.

Thanks,
Mark

yrosseel

unread,
Jan 25, 2015, 9:06:04 AM1/25/15
to lav...@googlegroups.com
On 01/18/2015 09:47 PM, Mark Seeto wrote:
> I have a related question about this.
>
> I had assumed (perhaps incorrectly) that if I planned to use the std.lv
> column or the std.all column from parameterEstimates, then it would not
> make any difference whether I had "std.lv=TRUE" in the call to the sem
> function.

I think you assumed correctly. The 'bug' that was fixed for the std.all
column a few days ago, also applies to the std.lv column.

This is now fixed in 0.5-18.775.

Please continue scrutinizing lavaan output! (in particular under
non-standard conditions)

Yves.

Mark Seeto

unread,
Jan 26, 2015, 4:21:20 AM1/26/15
to lav...@googlegroups.com

Thanks Yves.
Reply all
Reply to author
Forward
0 new messages