Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sem_appl

Structural equation modeling approach


Description

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.

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

dat <- generate_data(setting = "GLM")
sem_appl(Y = dat$Y, X = dat$X, K = dat$K, L = dat$L)

CIEE

Estimating and Testing Direct Effects in Directed Acyclic Graphs using Estimating Equations

v0.1.1
GPL-2
Authors
Stefan Konigorski [aut, cre], Yildiz E. Yilmaz [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.