Learn R Programming

psycho (version 0.4.91)

standardize.lm: Standardize Coefficients.

Description

Compute standardized coefficients.

Usage

# S3 method for lm
standardize(x, method = "refit", partial_sd = FALSE,
  preserve_factors = TRUE, ...)

Arguments

x

A linear model.

method

The standardization method. Can be "refit" (will entirely refit the model based on standardized data. Can take some time) or "posthoc".

partial_sd

Logical, if set to TRUE, model coefficients are multiplied by partial SD, otherwise they are multiplied by the ratio of the standard deviations of the independent variable and dependent variable.

preserve_factors

Standardize factors-related coefs only by the dependent variable (i.e., do not standardize the dummies generated by factors).

...

Arguments passed to or from other methods.

Examples

Run this code
# NOT RUN {
library(psycho)

df <- mtcars %>%
  mutate(cyl = as.factor(cyl))

fit <- lm(wt ~ mpg * cyl, data = df)
fit <- lmerTest::lmer(wt ~ mpg * cyl + (1 | gear), data = df)

summary(fit)
standardize(fit)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab