Skip to contents

DOI CRAN Status R-Universe Status Make Project R-CMD-check R Package Test Coverage Lint R Package Package Website (GitHub Pages) Compile LaTeX Shell Check pages-build-deployment codecov

Installation

You can install the CRAN release of semmcci with:

install.packages("semmcci")

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

if (!require("remotes")) install.packages("remotes")
remotes::install_github("jeksterslab/semmcci")

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 corresponding sampling variance-covariance matrix Var̂(𝛉̂)\widehat{\mathrm{Var}} \left( \hat{\boldsymbol{\theta}} \right).

𝛉̂*𝒩(𝛉̂,Var̂(𝛉̂))\begin{equation} \hat{\boldsymbol{\theta}}^{\ast} \sim \mathcal{N} \left( \hat{\boldsymbol{\theta}}, \widehat{\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α)%100(1 - \alpha)\% from the generated sampling distribution, where α\alpha is the significance level.

semmcci

Monte Carlo confidence intervals for free and defined parameters 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 three main functions, namely, MC(), MCMI(), and MCStd(). The output of lavaan is passed as the first argument to the MC() function or the MCMI() 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 or the MCMI() function to the MCStd() function. A description of the package and code examples are presented in Pesigan and Cheung (2024: https://doi.org/10.3758/s13428-023-02114-4).

Citation

To cite semmcci in publications, please cite Pesigan & Cheung (2024).

References

Pesigan, I. J. A., & Cheung, S. F. (2024). Monte Carlo confidence intervals for the indirect effect with missing data. Behavior Research Methods, 56(3), 1678–1696. https://doi.org/10.3758/s13428-023-02114-4
R Core Team. (2025). R: A language and environment for statistical computing. R Foundation for Statistical Computing. https://www.R-project.org/