Structural equation modeling approach
Function which uses the sem
function in the
lavaan
package to fit the model
L = α0 + α1*X + ε1, ε1 ~ N(0,σ1^2)
K = α2 + α3*X + α4*L + ε2, ε2 ~ N(0,σ2^2)
Y = α5 + α6*K + αXY*X + ε3, ε3 ~ N(0,σ3^2)
in order to obtain point and standard error estimates of the parameters α1, α3, α4, α6, αXY for the GLM setting. See the vignette for more details.
sem_appl(Y = NULL, X = NULL, K = NULL, L = NULL)
Y |
Numeric input vector for the primary outcome. |
X |
Numeric input vector for the exposure variable. |
K |
Numeric input vector for the intermediate outcome. |
L |
Numeric input vector for the observed confounding factor. |
Returns a list with point estimates of the parameters
(point_estimates
), standard error estimates
(SE_estimates
) and p-values from large-sample
Wald-type tests (pvalues
).
dat <- generate_data(setting = "GLM") sem_appl(Y = dat$Y, X = dat$X, K = dat$K, L = dat$L)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.