Learn R Programming

The regmed Package

Mediation analysis for multiple mediators by penalized structural equation models using sparse group lasso. The penalty considers the natural groupings of parameters that determine mediation, as well as encourages sparseness of the model parameters.

The regmed.grid() Function

regmed.grid() is a function that fits regularized mediation models over a vector grid of lambda penalty values. Structural equation models for analysis of multiple mediators are extended by creating a sparse group lasso penalized model such that the penalty considers the natural groupings of the pair of parameters that determine mediation, as well as encourages sparseness of the model parameters.

The regmed.fit() Function

regmed.fit() fits a regularized mediation model for a specified lambda penalty value. We provide summary and plot methods implemented on the S3 class created by the function.

Publication

Copy Link

Version

Install

install.packages('regmed')

Monthly Downloads

257

Version

2.1.5

License

GPL (>= 2)

Maintainer

Jason Sinnwell

Last Published

August 28th, 2025

Functions in regmed (2.1.5)

mvregmed.lavaan.model

Setup a model for input to lavaan
regmed.edges

For an object of class regmed, create edges for a graph object that can be used for plots, or for creating models input to lavaan function sem
regmed.grid.bestfit

Find best fitting regmed model from regmed.grid object.
regmed.fit

Regularized Mediation model for a specified lambda penalty value.
plot.regmed.grid

Plots for regmed.grid object.
regmed.grid

Regularized mediation models over a vector grid of lambda penalty values.
mvregmed.lavaan.dat

Set up data to input to lavaan sem
plot.mvregmed.grid

Plot penalty parameter lambda versus BIC for model fits
regmed-package

tools:::Rd_package_title("regmed")
regmed.prefilter

Prefilter to reduce the number of mediators for subsequent analyses
regmed.lavaan.model

Create a lavaan model
summary.mvregmed

Summary of mvregmed object
regmed.lavaan.dat

Set up data to input to lavaan sem
medsim

Simulated dataset for regmed package
mvregmed.dat.check

Helper function to check x, y, mediator for input to mvregmed functions
mvregmed.grid.data

Helper function to summarize fits of models across a grid of lambda values
mvregmed.grid

Fit a grid of mvregmed models over a vector of lambda penalty parameters
mvregmed.init

Helper function to setup data and parameters for input to mvregmed.fit and mvregmed.grid
mvregmed.grid.bestfit

Choose best fit model from a grid search based on minimum Bayesian Information Criterion
mvregmed.grid.update

Helper function to update parameters in a grid search
mvregmed.edges

For an object of class mvregmed, create edges for a graph object that can be used for plots, or for creating models input to lavaan function sem
mvregmed.fit

Multivariate regularized mediation model
mvregmed.graph.attributes

Setup attributes of graph object for plotting