Skip to contents

Let the simple mediation model be defined by the equations $$Y = \delta_{Y} + \tau^{\prime} X + \beta M + \varepsilon_{Y},$$ and $$M = \delta_{M} + \alpha X + \varepsilon_{M}.$$ The function generates data from the multivariate normal distribution using the model-implied mean vector and covariance matrix of the simple mediation model. See MASS::mvrnorm() for more details.

Usage

GenData(n = 100L, tauprime = 0, beta = 0.5, alpha = 0.5, mu = 0, sigmasq = 1)

Arguments

n

Positive integer. Sample size.

tauprime

Numeric. \(\tau^{\prime}\), that is, the slope for \(Y\) regressed on \(X\), adjusting for \(M\).

beta

Numeric. \(\beta\), that is, the slope for \(Y\) regressed on \(M\), adjusting for \(X\).

alpha

Numeric vector. Significance level.

mu

Numeric. Common mean for \(X\), \(M\), and \(Y\), that is, \(\mu_{X} = \mu_{M} = \mu_{Y}\).

sigmasq

Numeric. Common variance for \(X\), \(M\), and \(Y\), that is, \(\sigma^{2}_{X} = \sigma^{2}_{M} = \sigma^{2}_{Y}\).

Value

Returns a matrix.

References

MacKinnon, D. P. (2008). Introduction to statistical mediation analysis. Lawrence Erlbaum Associates.

See also

Other Data Generation Functions: AmputeData(), ImputeData()

Author

Ivan Jacob Agaloos Pesigan