mdn {iMediate} | R Documentation |
Mediation Analysis via Likelihood
Description
mdn
conducts mediation analysis in terms of likelihood.
Usage
mdn(fit.M, fit.Y, X, sig.level = 0.05, B = 0)
Arguments
fit.M |
a fitted model object for mediator. It is an object from which
the function |
fit.Y |
a fitted model object for outcome. It can be of a class different from the model for the mediator |
X |
a character string of the name of the treatment variable. |
sig.level |
a numerical variable specifying the significance level for the test of the mediated effect. |
B |
an integer specifying the number of replicates used in the bootstrapping method for the confidence interval. Default value is 0 and bootstrapping is not conducted |
Details
Necessary log-likelihoods are extracted from the two fitted models. Various effects
are then calculated. Significance of the mediated effect is known up to
whether it is larger or smaller than sig.level
. If it is larger, a 1
is reported; otherwise a 0 is reported. There is no p-value.
Value
A list with class “mdn
” containing the following
components:
result |
a data frame containing the results of the
mediation analysis. The are five variables. They include estimates of
various effects and lower and upper bounds of the boostrap confidence
interval at level (1- |
test |
a character string specifying the test statistic used for the mediated effect |
Test |
a numerical value of 0 or 1. If the specified test statistic is significant, its value is 1; otherwise its value is 0 |
sig.level |
a numerical variable specifying the significance level for the test of the mediated effect. |
Sample.size |
number of subjects in the data |
B |
an integer specifying the number of replicates used for the bootstrapping |
Author(s)
Kai Wang <kai-wang@uiowa.edu>
References
Berger, R.L. (1997) Likelihood ratio tests and intersection-union tests. Advances in statistical decision theory and applications. Birkh\"auser Boston, 225-237.
Wang, K. (2019) Likelihood-based analysis of the statistical effects of a treatment on an outcome. Submitted.
Examples
data("jobs", package = "mediation")
fit.M <- lm(job_seek ~ treat + econ_hard + sex + age, data=jobs)
fit.Y <- lm(depress2 ~ treat + job_seek + econ_hard + sex + age, data=jobs)
mdn(fit.M, fit.Y, "treat")
mdn(fit.M, fit.Y, "treat", B=100)