Lifecycle: stable Project Status: Active - The project has reached a stable, usable state and is being actively developed. CRAN status CRAN: Release Date CRAN RStudio mirror downloads Code size Last Commit at Master R-CMD-check DOI

stdmod: Standardized Moderation

(Version 0.2.14, updated on 2026-07-23, release history)

IMPORTANT NOTICE

This package will no longer be actively updated. It will still be maintained. However, new features will not be added. The package manymome can do all the tasks in stdmod related to computing, testing, and printing conditional effects, and can be used for any number of moderators. The package betaselectr can do all the tasks related to forming confidence intervals for properly standardized coefficients, in both regression models fitted by stats::lm() and stats::glm(), as well as structural equation models fitted by lavaan::sem().

For standardizing only selected variables and for properly standardizing product terms in regression models fitted by stats::lm(), the function lm_betaselect() from betaselectr can be used instead of std_selected() and std_selected_boot(). The package also has supports models fitted by stats::glm(), such as logistic regression models. See this article for a demonstration.

For standardizing only selected variables in models fitted by lavaan, lavaan natively supports this since version 0.7-2, through setting type to a character vector of the variables to be standardized. Alternatively, the function lav_betaselect() from betaselectr can also be used. lav_betaselect() also supports properly standardizing a product term. In addition to bootstrap confidence intervals, lav_betaselect() also supports delta-method confidence intervals.

For computing conditional effects and plotting conditional effects in regression models, the package manymome has more comprehensive support. See these articles for some demonstration. The package also supports moderation in structural equation models fitted by lavaan.

(Important changes since 0.2.0.0: Bootstrap confidence intervals and variance-covariance matrix of estimates are the defaults of confint() and vcov() for the output of std_selected_boot().)

This package includes functions for computing a standardized moderation effect and forming its confidence interval by nonparametric bootstrapping correctly. It was described briefly in the following publication (OSF project page). It supports moderated regression conducted by stats::lm() and path analysis with product term conducted by lavaan::lavaan().

More information on this package:

https://sfcheung.github.io/stdmod/

The function lm_betaselect() from the package betaselectr can be used in place of std_selected() and std_selected_boot(). A demonstration of lm_betaselect() can be found here. This package also has glm_betaselect() for models, such as logistic regression models, fitted by stats::glm() (see a demonstration here).

The function lav_betaselect() from the package betaselectr is a version of std_selected() but for structural equation models fitted by lavaan::sem(). A demonstration of lav_betaselect() can be found here.

Although the package manymome is mainly for mediation and moderated mediation, moderation is a special case and is also supported. The plot method in manymome is more powerful than plotmod, supports not only a regression model but also a structural equation model, and also supports any number of moderators. The function manymome::cond_effects() in manymome is also more powerful than cond_effect in stdmod, supporting both regression models and structural equation models.

Installation

The stable CRAN version can be installed by install.packages():

install.packages("stdmod")

The latest version of this package at GitHub can be installed by remotes::install_github():

remotes::install_github("sfcheung/stdmod")

Implementation

The main function, std_selected(), accepts an lm() output, standardizes variables by users, and update the results. If interaction terms are present, they will be formed after the standardization. If bootstrap confidence intervals are requested using std_selected_boot(), both standardization and regression will be repeated in each bootstrap sample, ensuring that the sampling variability of the standardizers (e.g., the standard deviations of the selected variables), are also taken into account.

Issues

If you have any suggestions and found any bugs, please feel free to open a GitHub issue. Thanks.