A set of functions used to automate commonly used methods in regression analysis. This includes plotting interactions, calculating simple slopes, calculating standardized coefficients, etc. See the reghelper documentation for more information, documentation, and examples.
The reghelper
R package includes a set of functions used to automate commonly used methods in regression analysis. This includes plotting interactions, calculating simple slopes, calculating standardized coefficients, etc.
Version 0.3.4 has been released. However, be aware that this package is still in development, and as such, bugs may still exist, and functions and function parameters may still be subject to change.
The most recent stable release is available on CRAN, and can be installed like so:
install.packages("reghelper")
You can also install the stable release from Github:
install.packages("devtools")devtools::install_github("jeff-hughes/reghelper")
If you would like to install the latest development version, you can do so with the following code:
install.packages("devtools")devtools::install_github("jeff-hughes/[email protected]")
Networked computers can sometimes result in installation issues, as the install_github
function sometimes has difficulty with networked directories. If this happens to you, use the .libPaths()
function to find the path to your R libraries. That will likely give you a path starting with two backslashes, but you will need to convert that to a path starting with a drive letter (e.g., 'C:', 'D:'). From there, use the following code:
install.packages("devtools")devtools::install_github("jeff-hughes/reghelper", args=c('--library="N:/path/to/libraries/"'))
Obviously, change the path to the path where your R libraries are stored.
So far, most functions that I had originally planned to include have been implemented for lm
models. These functions include:
beta
Calculates standardized beta coefficients.build_model
Allows variables to be added to a series of regression models sequentially (similar to SPSS).ICC
Calculates the intra-class correlation for a multi-level model.cell_means
Calculates the estimated means for a fitted model.graph_model
Easily graph interactions at +/- 1 SD (uses ggplot2 package).sig_regions
Calculate the Johnson-Neyman regions of significance for an interaction.simple_slopes
Easily calculate the simple effects of an interaction.The table below shows the current types of models for which each function has been implemented:
Function | lm | glm | aov | lme | lmer |
---|---|---|---|---|---|
beta | ✓ | ✓ | ✓ | ✓ | ✓ |
build_model | ✓ | ✓ | ✓ | ||
ICC | – | – | – | ✓ | ✓ |
cell_means | ✓ | ✓ | ✓ | ||
graph_model | ✓ | ✓ | ✓ | ✓ | ✓ |
sig_regions | ✓ | ✓ | – | ||
simple_slopes | ✓ | ✓ | ✓ | ✓ | ✓ |
This is a patch release to cover changes made to the ggplot2 package.
BUG FIXES
This is a patch release covering changes necessary to prepare for submission to CRAN. Most changes will not affect current code; however, be aware of the following changes:
Many of the functions have had the dots parameter (...) added, to ensure consistency with the S3 generic function. However, any extra parameters will simply be ignored. Thus, this does not impact any user code.
Package functions which implement the following generic methods have had their first parameter renamed, again for consistency with the S3 generic: summary, print, coef, residuals, fitted. In most cases, this will not impact user code, unless you have used named parameters, e.g., summary(model=results)
should now be summary(object=results)
.
BUG FIXES
Fixed bug when using build_model
but only providing a single model to be run.
Created special print method for simple_slopes
so that "lme4" models print correctly.
Fixed bug (correctly this time) with simple_slopes
using incorrect contrasts for factor variables.
BUG FIXES
simple_slopes
using incorrect contrasts for factor variables. Resolves Issue #2.build_model
now drops missing data based on the variables included in the final model, so that all models are tested on the same data.
The titles
parameter of graph_model
has been changed to labels
, and now takes a named list rather than relying on the index of a character vector.
graph_model
function extended to include lme
and merMod
models.
NEW FEATURES
beta
function extended to include lme
and merMod
models.
build_model
function extended to include aov
and glm
models.
cell_means
function extended to include glm
models.
graph_model
function extended to include aov
and glm
models.
sig_regions
function extended to include glm
models.
MAJOR CHANGES
block_lm
function name to build_model
.NEW FEATURES
Added examples to documentation for all functions.
beta
function extended to include glm
models.
cell_means
function extended to include aov
models.
ICC
function extended to include merMod
models (from "lme4" package).
simple_slopes
function extended to include aov
, glm
, lme
, and merMod
models.
simple_slopes
now includes print
function to include significance stars.
BUG FIXES
build_model
, cell_means
, and graph_model
. Resolves Issue #1.NEW FEATURES
beta
function calculates standardized beta coefficients.
block_lm
function allows variables to be added to a series of regression models sequentially (similar to SPSS).
ICC
function calculates the intra-class correlation for a multi-level model (lme only at this point).
cell_means
function calculates the estimated means for a fitted model.
graph_model
function graphs interactions at +/- 1 SD (uses ggplot2 package).
simple_slopes
function calculates the simple effects of an interaction.
sig_regions
function calculate the Johnson-Neyman regions of significance for an interaction.