Learn R Programming

sjstats (version 0.17.4)

std_beta: Standardized beta coefficients and CI of linear and mixed models

Description

Returns the standardized beta coefficients, std. error and confidence intervals of a fitted linear (mixed) models.

Usage

std_beta(fit, ...)

# S3 method for merMod std_beta(fit, ci.lvl = 0.95, ...)

# S3 method for lm std_beta(fit, type = "std", ci.lvl = 0.95, ...)

# S3 method for gls std_beta(fit, type = "std", ci.lvl = 0.95, ...)

Arguments

fit

Fitted linear (mixed) model of class lm, merMod (lme4 package), gls or stanreg.

...

Currently not used.

ci.lvl

Numeric, the level of the confidence intervals.

type

If fit is of class lm, normal standardized coefficients are computed by default. Use type = "std2" to follow Gelman's (2008) suggestion, rescaling the estimates by deviding them by two standard deviations, so resulting coefficients are directly comparable for untransformed binary predictors.

Value

A tibble with term names, standardized beta coefficients, standard error and confidence intervals of fit.

Details

“Standardized coefficients refer to how many standard deviations a dependent variable will change, per standard deviation increase in the predictor variable. Standardization of the coefficient is usually done to answer the question of which of the independent variables have a greater effect on the dependent variable in a multiple regression analysis, when the variables are measured in different units of measurement (for example, income measured in dollars and family size measured in number of individuals)” (Source: Wikipedia)

References

Wikipedia: Standardized coefficient

Gelman A. 2008. Scaling regression inputs by dividing by two standard deviations. Statistics in Medicine 27: 2865-2873 http://www.stat.columbia.edu/~gelman/research/published/standardizing7.pdf

Examples

Run this code
# NOT RUN {
# fit linear model
fit <- lm(Ozone ~ Wind + Temp + Solar.R, data = airquality)
# print std. beta coefficients
std_beta(fit)

# print std. beta coefficients and ci, using
# 2 sd and center binary predictors
std_beta(fit, type = "std2")

# std. beta for mixed models
library(lme4)
fit1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
std_beta(fit)

# }

Run the code above in your browser using DataLab