## 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 $\widehat{\mathrm{Var}} \left( \hat{\boldsymbol{\theta}} \right)$.

$$$\hat{\boldsymbol{\theta}}^{\ast} \sim \mathcal{N} \left( \hat{\boldsymbol{\theta}}, \widehat{\mathrm{Var}} \left( \hat{\boldsymbol{\theta}} \right) \right)$$$

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.

## 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 (2023: https://doi.org/10.3758/s13428-023-02114-4).

## Citation

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

## References

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. https://doi.org/10.1207/s15327906mbr3901_4
Pesigan, I. J. A., & Cheung, S. F. (2023). 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
Preacher, K. J., & Selig, J. P. (2012). Advantages of Monte Carlo confidence intervals for indirect effects. Communication Methods and Measures, 6(2), 77–98. https://doi.org/10.1080/19312458.2012.679848
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. https://doi.org/10.1080/00273171.2019.1618545
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. https://doi.org/10.1080/10705511.2015.1057284