Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate standard errors from sam() for parameters constrained equal across groups #218

Open
marklhc opened this issue Aug 23, 2021 · 1 comment
Labels

Comments

@marklhc
Copy link

marklhc commented Aug 23, 2021

From https://groups.google.com/g/lavaan/c/SvgKCKqiOoY. It seems that the equality constraint is currently not taking into accounting when computing the standard errors in multiple-group sam().

library(lavaan)
#> This is lavaan 0.6-9
#> lavaan is FREE software! Please report any bugs.

HS.model <- " visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9
              visual ~~ c(cov_v, cov_v) * visual "

# SEM
sem_fit <- cfa(HS.model,
    data = HolzingerSwineford1939,
    group = "school",
    group.equal = c("loadings")
)

subset(parameterEstimates(sem_fit), label == "cov_v")
#>       lhs op    rhs block group label   est    se     z pvalue ci.lower
#> 10 visual ~~ visual     1     1 cov_v 0.759 0.135 5.621      0    0.494
#> 46 visual ~~ visual     2     2 cov_v 0.759 0.135 5.621      0    0.494
#>    ci.upper
#> 10    1.023
#> 46    1.023

# SAM (Global)

samg_fit <- sam(HS.model, cmd = "cfa",
    data = HolzingerSwineford1939,
    sam.method = "global",
    group = "school",
    group.equal = c("loadings")
)

subset(parameterEstimates(samg_fit), label == "cov_v")
#>       lhs op    rhs block group label   est    se     z pvalue ci.lower
#> 10 visual ~~ visual     1     1 cov_v 0.647 0.151 4.295      0    0.352
#> 46 visual ~~ visual     2     2 cov_v 0.647 0.148 4.375      0    0.357
#>    ci.upper
#> 10    0.942
#> 46    0.937

Created on 2021-08-23 by the reprex package (v2.0.1)

@yrosseel yrosseel added the bug label Jun 20, 2022
@yrosseel
Copy link
Owner

Just a sign of life. This turns out to be much more difficult to fix than expected. It may be that, due to the twostep nature of computing the standard errors, this will never work. At least not with the current approach. I will keep this issue open, as this is simply unresolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants