Closed TDJorgensen closed 1 year ago
Whoops, I didn't make a fork because I forgot this PR was still open. Just added another commit to resolve #266
M <- matrix(c(1, 0.7, 0.7, 0.5, 0.7, 1, 0.95, 0.3, 0.7, 0.95, 1, 0.3, 0.5, 0.3, 0.3, 1),
nrow=4, ncol=4)
set.seed(1901)
data_small <- as.data.frame(MASS::mvrnorm(n = 30, mu = rep(0,4), Sigma = M))
data_small$weights <- c(rep(0.3, 15), rep(100000,15))
lavCor(data_small, estimator = "ML", output = "cov", sampling.weights = "weights")
That output matches the one estimated using weights in my lavaan-forum response:
https://groups.google.com/g/lavaan/c/qdwWEzJb_Qc/m/hArsqyE2BAAJ
Would you be opposed to this feature? I would find it useful for both
lavaan.mi
andlavaan.srm
, so adding it here would save me the trouble of writing separateprint()
methods for each. I basically just copied your code inprint.lavaan.list()
, but useattributes()
rather thanattr()
to simultaneous delete both header and footer from the copyy <- x
.