Skip to contents

CRAN Status R-Universe Status R-CMD-check test-coverage lint codecov


You can install the CRAN release of semmcci with:


You can install the development version of semmcci from GitHub with:

if (!require("remotes")) install.packages("remotes")

The Monte Carlo Method

In the Monte Carlo method, a sampling distribution of parameter estimates \(\hat{\boldsymbol{\theta}}^{\ast}\) is generated from the multivariate normal distribution using the parameter estimates \(\hat{\boldsymbol{\theta}}\) and the sampling variance-covariance matrix \(\mathrm{Var} \left( \hat{\boldsymbol{\theta}} \right)\).

\[\begin{equation} \hat{\boldsymbol{\theta}}^{\ast} \sim \mathcal{N} \left( \hat{\boldsymbol{\theta}}, \mathrm{Var} \left( \hat{\boldsymbol{\theta}} \right) \right) \end{equation}\]

Confidence intervals for defined parameters \(\mathbf{g} \left( \hat{\boldsymbol{\theta}} \right)\) are generated by obtaining percentiles corresponding to \(100(1 - \alpha)\%\) from the generated sampling distribution, where \(\alpha\) is the significance level.


Monte Carlo confidence intervals for free and defined parameters in models fitted in the structural equation modeling package lavaan can be generated using the semmcci package. The package has two main functions, namely, MC() and MCStd(). The output of lavaan is passed as the first argument to the MC() function to generate Monte Carlo confidence intervals. Monte Carlo confidence intervals for the standardized estimates can also be generated by passing the output of the MC() function to the MCStd() function.


MacKinnon, D. P., Lockwood, C. M., & Williams, J. (2004). Confidence limits for the indirect effect: Distribution of the product and resampling methods. Multivariate Behavioral Research, 39(1), 99–128.

Preacher, K. J., & Selig, J. P. (2012). Advantages of Monte Carlo confidence intervals for indirect effects. Communication Methods and Measures, 6(2), 77–98.

Tofighi, D., & Kelley, K. (2019). Indirect effects in sequential mediation models: Evaluating methods for hypothesis testing and confidence interval formation. Multivariate Behavioral Research, 55(2), 188–210.

Tofighi, D., & MacKinnon, D. P. (2015). Monte Carlo confidence intervals for complex functions of indirect effects. Structural Equation Modeling: A Multidisciplinary Journal, 23(2), 194–205.