On 2/2/23 07:19, Shu Fai Cheung (張樹輝) wrote:
> However, how are the y-variables sampled? In multiple regression, if the
> predictors are treated as fixed, bootstrapping can be done on the
> residuals. I am not sure whether this is what lavaan does when se =
> "bootstrap" and fixed.x are used together.
Nothing special. It just samples the rows of the original sample as
usual, and for each fit, we use fixed.x = TRUE.
In that sense, using fixed.x = TRUE or fixed.x = FALSE has little impact
on the bootstrap standard errors of the regression coefficients. That
also seems true for the analytic standard errors. Consider these three
examples:
fit1 <- sem(model, data = HolzingerSwineford1939, fixed.x = FALSE)
parameterEstimates(fit1) |> subset(op == "~")
fit2 <- sem(model, data = HolzingerSwineford1939, fixed.x = TRUE)
parameterEstimates(fit2) |> subset(op == "~")
fit3 <- sem(model, data = HolzingerSwineford1939, conditional.x = TRUE)
parameterEstimates(fit3) |> subset(op == "~")
which results three times in
lhs op rhs est se z pvalue ci.lower ci.upper
1 x9 ~ x1 0.254 0.051 4.998 0.000 0.155 0.354
2 x9 ~ x2 0.049 0.048 1.025 0.305 -0.045 0.144
3 x9 ~ x3 0.160 0.053 3.004 0.003 0.056 0.265
Having said this, at the beginning of the file lav_bootstrap.R, I wrote
(circa 2012):
"Question: if fixed.x=TRUE, should we not keep X fixed, and bootstrap Y
only, conditional on X??"
So I wondered about this too...
Yves.