Code From Papers

Sampling ratio for multilevel SEM

Here is R code used for Monte Carlo simulations. This relies heavily on the MplusAutomation package in R. An example Mplus input file for part 1: data generation can be found here, while an example Mplus input file for part 2: data analysis can be found here. For the illustrative example, the doubly latent model can be estimated in both Mplus and R using this data.

Moderated nonlinear factor analysis for SEM

Here is R code used for all steps of conducting moderated nonlinear factor analysis using example data.

Propensity score matching and weighting

This provides R code for a series of Monte Carlo simulations comparing propensity score matching and weighting methods for achieving covcariate balance in observational studies, with an interest on varying levels of treatment exposure.

Statistical power for cluster randomized trials

Here is R code used to conduct a Monte Carlo simulation of statistical power for cluster randomized controlled trials with clusters of varying size.

Example: Missing data

This provides an example of R code to handle missing data (see the PDF version here , as well as the background reading).

Example: Propensity score matching and weighting

This provides an example of R code using matching and weighting for causal inference (see the PDF version here).