Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

qprodnormal

Quantile for the Distribution of Product of Two Normal Variables


Description

Generates quantiles for the distribution of product of two normal random variables

Usage

qprodnormal(p, mu.x, mu.y, se.x, se.y, rho=0, lower.tail=TRUE,
type="dop", n.mc=1e5)

Arguments

p

probability

mu.x

mean of x

mu.y

mean of y

se.x

standard error (deviation) of x

se.y

standard error (deviation) of y

rho

correlation between x and y, where -1 < rho < 1. The default value is 0.

lower.tail

logical; if TRUE (default), the probability is P[X*Y < q]; otherwise, P[X*Y > q]

type

method used to compute P[X*Y < q]. It takes on the values "dop" (default), "MC", or "all".

n.mc

when type="MC", n.mc determines the sample size of Monte Carlo method. The default sample size is 1E5.

Details

This function returns a quantile and the associated error (accuracy) corresponding the requested percentile (probability) p of the distribution of product of mediated effect (product of two normal random variables). To obtain a quantile using a specific method, the argument type should be specified. The default method is type="dop", which uses the method described by Meeker and Escobar (1994) to evaluate the CDF of the distribution of product of two normal variables. type="MC" uses the Monte Carlo approach (Tofighi & MacKinnon, 2011). type="all" prints quantiles using all three options. For the method type="dop", the error is the modulus of absolute error for the numerical integration (for more information see Meeker and Escobar, 1994). For type="MC", the error refers to the Monte Carlo error.

Value

An object of the type list that contains the following values:

q

quantile corresponding to probability p

error

estimate of the absolute error

Author(s)

Davood Tofighi dtofighi@unm.edu and David P. MacKinnon davidpm@asu.edu

References

MacKinnon, D. P., Fritz, M. S., Williams, J., and Lockwood, C. M. (2007). Distribution of the product confidence limits for the indirect effect: Program PRODCLIN. Behavior Research Methods, 39, 384–389.

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

See Also

Examples

##lower tail
qprodnormal(p=.1, mu.x=.5, mu.y=.3, se.x=1, se.y=1, rho=0, lower.tail =
TRUE, type="all")
##upper tail
qprodnormal(p=.1, mu.x=.5, mu.y=.3, se.x=1, se.y=1, rho=0, lower.tail =
FALSE, type="all")

RMediation

Mediation Analysis Confidence Intervals

v1.1.4
GPL-2
Authors
Davood Tofighi <dtofighi@unm.com> and David P. MacKinnon <davidpm@asu.edu>
Initial release
2016-3-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.