coefs.sensmed {sensmediation} | R Documentation |
ML estimation of regression parameters for calculation of direct and indirect effects under unobserved confounding
Description
This function gives ML estimates of the regression parameters used to calculate mediation effects and perform sensitivity analysis. The optimization is
performed using maxLik
, see Details for more information. Called by sensmediation
.
Usage
coefs.sensmed(model.expl, model.resp, Rho, progress = TRUE, ...)
Arguments
model.expl |
Fitted |
model.resp |
Fitted |
Rho |
The sensitivity parameter vector. If |
progress |
Logical, indicating whether or not the progress (i.e. the |
... |
Additional arguments to be passed on to the |
Details
The maximization of the log-likelihood is performed using maxLik
, the default is to use the Newton-Raphson method and an analytic gradient and Hessian.
Value
coefs.sensmed
returns a list with elements:
call |
The matched call |
coef |
A matrix with the estimated regression parameters for |
sigma.res.resp |
If |
sigma.res.expl |
If |
Rho |
The sensitivity parameter vector. |
expl.coef |
A matrix with the estimated regression parameters for |
model.expl |
the original fitted |
model.resp |
the original fitted |
X.expl |
The model matrix (see |
X.resp |
The model matrix (see |
outc.resp |
The outcome variable of |
outc.expl |
The outcome variable of |
sigmas |
A list with the estimated covariance matrices for the regression parameters of |
max.info |
Information about the maximization (whether or not the convergence was successful, |
value |
The values of the loglikelihood function for the best set of regression parameters from the optimization for each |
Author(s)
Anita Lindmark
References
Henningsen, A., Toomet, O. (2011). maxLik: A Package for Maximum Likelihood Estimation in R, Computational Statistics, 26(3), pp. 443–458.
See Also
Examples
## Not run:
# Example with data from Riksstroke (the Swedish stroke register)
data(RSdata)
# Probit mediator and outcome models:
m.model <- glm(lowered.consc ~ AF + age.cat + sex, data = RSdata,
family = binomial(link = 'probit'))
o.model <- glm(cf.3mo ~ AF + lowered.consc + age.cat + sex, data = RSdata,
family = binomial(link = 'probit'))
# Estimation of regression coefficients under different values of Rho
# Rho = correlation between error terms in mediator and outcome model:
coefs.MY <- coefs.sensmed(model.expl = m.model, model.resp = o.model, Rho = seq(0, 0.5, 0.1))
# Outcome model regression coefficients:
coefs.MY$coef
## End(Not run)