medci(mu.x, mu.y, se.x, se.y, rho = 0, alpha = 0.05, type = "prodclin",
plot=FALSE, plotCI=FALSE, n.mc = 1e+05, ...)
rho
< 1. The default value is 0."prodclin"
(default), "DOP"
,
"MC"
, "asymp"
or "all"
.TRUE
, plots the distribution of n.mc
data points
from the distribution of product of two normal random variables using the density estimates
provided by the function density
TRUE
, overlays a confidence interval with error
bars on the plot for the mediated effect. Note that to obtain the CI
plot, one must also specify plot="TRUE"
. The default value is FALSE
.type="MC"
, n.mc
determines the sample
size for the Monte Carlo method. The default sample size is 1E5.type
should be
specified. The default is type="prodclin"
, which uses the PRODCLIN
program described by MacKinnon et al. (2007). type="DOP"
uses the code we wrote in Rto
implement the distribution of product of the coefficients method. Note that both
type="prodclin"
and type="DOP"
use the method described
by Meeker and Escobar (1994) to evaluate the CDF of the distribution
of product. type="MC"
uses the Monte Carlo approach to compute
the confidence interval (Tofighi & MacKinnon, 2011). type="asymp"
produces the asymptotic
normal confidence interval. The standard error for the asymptotic
normal confidence interval is based on the analytical results by Craig (1936). type="all"
prints confidence intervals using all four options.Meeker, W. and Escobar, L. (1994). An algorithm to compute the CDF of the product of two normal random variables. Communications in Statistics: Simulation and Computation, 23, 271--280.
Tofighi, D. and MacKinnon, D. P. (2011). RMediation: An R package for mediation analysis confidence intervals. Behavior Research Methods, 43, 692--700. doi:10.3758/s13428-011-0076-x
qprodnormal
pprodnormal
RMediation-package
##produces CI using PRODCLIN and density plot of distribution of xy
medci(mu.x=.2, mu.y=.4, se.x=1, se.y=1, rho=0, alpha=.05,
type="prodclin", plot=TRUE, plotCI=TRUE)
Run the code above in your browser using DataLab