coefs.sensmed: ML estimation of regression parameters for calculation of...

Description Usage Arguments Details Value Author(s) References See Also Examples

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

1
coefs.sensmed(model.expl, model.resp, Rho, progress = TRUE, ...)

Arguments

model.expl

Fitted glm model object. If sensitivity analysis to mediator-outcome confounding the mediator model. Otherwise the exposure model.

model.resp

Fitted glm model object. If sensitivity analysis to exposure-mediator confounding the mediator model. Otherwise the outcome model.

Rho

The sensitivity parameter vector. If type="my" the correlation between the error terms in the mediator and outcome models. If type="zm" the correlation between the error terms in the exposure and mediator models. If type="zy" the correlation between the error terms in the exposure and outcome models.

progress

Logical, indicating whether or not the progress (i.e. the proc.time for each Rho) of the optimization will be output

...

Additional arguments to be passed on to the maxLik function. Can be used to set the method and control arguments of the maxLik function.

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 model.resp over the range of Rho. One column per value of Rho.

sigma.res.resp

If model.resp is a linear regression model, the estimated standard deviation of the error term for each Rho.

sigma.res.expl

If model.expl is a linear regression model, the estimated standard deviation of the error term for each Rho.

Rho

The sensitivity parameter vector.

expl.coef

A matrix with the estimated regression parameters for model.expl over the range of Rho. One column per value of Rho.

model.expl

the original fitted glm object of model.expl.

model.resp

the original fitted glm object of model.resp.

X.expl

The model matrix (see model.matrix) of model.expl

X.resp

The model matrix (see model.matrix) of model.resp

outc.resp

The outcome variable of model.resp.

outc.expl

The outcome variable of model.expl.

sigmas

A list with the estimated covariance matrices for the regression parameters of model.resp and model.expl over Rho.

max.info

Information about the maximization (whether or not the convergence was successful, message, method and number of iterations) for each Rho, see maxLik for more information.

value

The values of the loglikelihood function for the best set of regression parameters from the optimization for each Rho, see maxLik.

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

sensmediation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

sensmediation documentation built on June 3, 2019, 9:02 a.m.