ci
function uses the Monte
Carlo (type="MC"
) and the asymptotic normal theory
(type="asymp"
) with the multivariate delta standard
error (Asymptotic--Delta) method (Sobel, 1982) to compute a
CI. In addition, for each of the methods, when a user
specifies plot=TRUE
and plotCI=TRUE
, a plot
of the sampling distribution of the quantity of interest in
the quant
argument and with an overlaid plot of the
CI will be produced. When type="all"
and
plot=TRUE
, two overlaid plots of the sampling
distributions corresponding to each method will be
produced; when plotCI=TRUE
, then the overlaid plots
of the CIs for both methods will be displayed as well.ci(mu, Sigma, quant, alpha = 0.05, type = "MC", plot = FALSE,
plotCI = FALSE, n.mc = 1e+06, ...)
mu=c(b1=.1,b2=3)
; otherwise, the coefficient names
are assigned autquant
is a formula that
must start with the symbol "tilde" (~
):
e.g., "MC"
(default) for Monte Carlo,
"asymp"
for Asymptotic-Delta, or "all"
that
produces CIs using both methods.TRUE
, plot the approximate
sampling distribution of the quantity of interest using
the specified method(s) in the argument type
. The
default value is FALSE
. When type="all"
,
superimposed denTRUE
, overlays a CI plot with
error bars on the density plot of the sampling
distribution of quant
. When type="all"
, the
superimposed CI plots generated by both methods are added
to the density plots. Notype
is "MC"
or "asymp"
,
ci
returns a list that contains:type="MC"
, error of the Monte Carlo estimate.type="all"
, ci
returns a list of two
objects, each of which a list that contains the
results produced by each method as described above.medci
RMediation-package
ci(mu=c(b1=1,b2=.7,b3=.6, b4= .45), Sigma=c(.05,0,0,0,.05,0,0,.03,0,.03),
quant=~b1*b2*b3*b4, type="all", plot=TRUE, plotCI=TRUE)
Run the code above in your browser using DataLab