Learn R Programming

CIEE (version 0.1.1)

sem_appl: Structural equation modeling approach

Description

Function which uses the sem function in the lavaan package to fit the model $$L = \alpha_0 + \alpha_1 \cdot X + \epsilon_1, \epsilon_1 \sim N(0,\sigma_1^2)$$ $$K = \alpha_2 + \alpha_3 \cdot X + \alpha_4 \cdot L + \epsilon_2, \epsilon_2 \sim~ N(0,\sigma_2^2)$$ $$Y = \alpha_5 + \alpha_6 \cdot K + \alpha_{XY} \cdot X + \epsilon_3, \epsilon_3 \sim N(0,\sigma_3^2)$$ in order to obtain point and standard error estimates of the parameters \(\alpha_1, \alpha_3, \alpha_4, \alpha_6, \alpha_{XY}\) for the GLM setting. See the vignette for more details.

Usage

sem_appl(Y = NULL, X = NULL, K = NULL, L = NULL)

Arguments

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.

Value

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).

Examples

Run this code
# NOT RUN {
dat <- generate_data(setting = "GLM")
sem_appl(Y = dat$Y, X = dat$X, K = dat$K, L = dat$L)

# }

Run the code above in your browser using DataLab