`monteCarloMed(expression, ..., ACM=NULL, rep=20000, CI=95, plot=FALSE, outputValues=FALSE)`

expression

A character scalar representing the computation of an indirect effect. Different parameters in the expression should have different alphanumeric values. Expressions can use either addition (+) or multiplication (*) operators.

...

Parameter estimates for all parameters named in

`expression`

. The order of parameters should follow from `expression`

(the first parameter named in `expression`

should be the first parameter listed in ...). Alternatively .ACM

A matrix representing the asymptotic covariance matrix of the parameters described in

`expression`

. This matrix should be a symetric matrix with dimensions equal to the number of parameters names in `expression`

. Information on findirep

The number of replications to compute. Many thousand are reccomended.

CI

Width of the confidence interval computed.

plot

Should the function output a plot of simulated values of the indirect effect?

outputValues

Should the function output all simulated values of the indirect effect?

- A list with two elements. The first element is the point estimate for the indirect effect. The second element is a matrix with values for the upper and lower limits of the confidence interval generated from the Monte Carlo test of mediation. If
`outputValues=TRUE`

, output will be a list with a list with the point estimate and values for the upper and lower limits of the confidence interval as the first element and a vector of simulated values of the indirect effect as the second element.

- LISREL

`vcov`

on the fitted lavaan object to print the ACM to the screen}#Simple two path mediation #Write expression of indirect effect med <- 'a*b' #Paramter values from analyses aparam <- 1 bparam<-2 #Asymptotic covariance matrix from analyses AC <- matrix(c(.01,.00002, .00002,.02), nrow=2, byrow=TRUE) #Compute CI, include a plot monteCarloMed(med, coef1=aparam, coef2=bparam, outputValues=FALSE, plot=TRUE, ACM=AC) #Use a matrix of parameter estimates as input aparam<-c(1,2) monteCarloMed(med, coef1=aparam, outputValues=FALSE, plot=TRUE, ACM=AC) #complex mediation with two paths for the indirect effect #Write expression of indirect effect med <- 'a1*b1 + a1*b2' #Paramter values and standard errors from analyses aparam <- 1 b1param<-2 b2param<-1 #Asymptotic covariance matrix from analyses AC <- matrix(c(1,.00002, .00003, .00002,1, .00002, .00003, .00002, 1), nrow=3, byrow=TRUE) #Compute CI do not include a plot monteCarloMed(med, coef1=aparam, coef2=b1param, coef3=b2param, ACM=AC)