View source: R/model_estimate.R
model_estimate | R Documentation |
This function gives the model estimates.
model_estimate(
X,
M,
Y,
I_update,
tol = 10^(-10),
max.iter = 10,
lambda1 = exp(1),
lambda2 = exp(-1),
alpha = 1,
penalty.factor = c(1, rep(1, ncol(M) * 2), rep(1, max(0, ncol(I_update)))),
verbose = FALSE,
Omega.out = FALSE
)
X |
one-dimensional exposure |
M |
multivariate mediators |
Y |
one-dimensional outcome |
I_update |
interaction term |
tol |
convergence criterion (default = -10^(-10)) |
max.iter |
maximum iteration (default = 10) |
lambda1 |
tuning parameter for regression coefficient L1 penalization |
lambda2 |
tuning parameter for covariance-inverse matrix |
alpha |
alpha in glmnet() (default = 1: lasso penalty) |
penalty.factor |
penalty factor vector, in the order of (c,b1,b2,a) |
verbose |
print progress (default = |
Omega.out |
output Omega estimates (default = |
c: direct effect estimate
hatb1: path b1 (M->Y given X) estimates
hatb2: path b2 (X*M->Y) estimates
hata: path a (X->M) estimates
nump: number of selected paths + 1 direct effect
Omega: estimated covariance-inverse matrix of the mediators
sigmasq: estimated variance of the outcome
data = dat_gen(N = 400, V = 50, es = 1, seed = 1234)
X = data$X; Y = data$Y; M = data$M; I = X*M
model_estimate(X, M, Y, I, lambda1 = 0.2, lambda2 = 0.1, alpha = 1, Omega.out = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.