Description Usage Arguments Details Value Author(s) References See Also Examples
scale_mod
(previously known as scale_lm
) takes fitted regression models
and scales all
predictors by dividing each by 1 or 2 standard deviations (as chosen by the
user).
1 2 3 4 5 6 7 8 
model 
A regression model of type 
... 
Ignored. 
binary.inputs 
Options for binary variables. Default is 
n.sd 
How many standard deviations should you divide by for standardization? Default is 1, though some prefer 2. 
center 
Default is 
scale.response 
Should the response variable also be rescaled? Default
is 
center.only 
Rather than actually scale predictors, just meancenter them. 
data 
If you provide the data used to fit the model here, that data
frame is used to refit the model instead of the 
vars 
A character vector of variable names that you want to be scaled. If NULL, the default, it is all predictors. 
apply.weighted.contrasts 
Factor variables cannot be scaled, but you
can set the contrasts such that the intercept in a regression model will
reflect the true mean (assuming all other variables are centered). If set
to TRUE, the argument will apply weighted effects coding to all factors.
This is similar to the R default effects coding, but weights according to
how many observations are at each level. An adapted version of

This function will scale all continuous variables in a regression model for ease of interpretation, especially for those models that have interaction terms. It can also meancenter all of them as well, if requested.
The scaling happens on the input data, not the terms themselves. That means interaction terms are still properly calculated because they are the product of standardized predictors, not a standardized product of predictors.
This function reestimates the model, so for large models one should expect a runtime equal to the first run.
The functions returns a refitted model object, inheriting from whichever class was supplied.
Jacob Long <[email protected]>
Bauer, D. J., & Curran, P. J. (2005). Probing interactions in fixed and multilevel regression: Inferential and graphical techniques. Multivariate Behavioral Research, 40(3), 373400.
Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analyses for the behavioral sciences (3rd ed.). Mahwah, NJ: Lawrence Erlbaum Associates, Inc.
sim_slopes
performs a simple slopes analysis.
interact_plot
creates attractive, userconfigurable plots of
interaction models.
Other standardization, scaling, and centering tools: center_mod
,
center
, gscale
,
standardize
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  fit < lm(formula = Murder ~ Income * Illiteracy,
data = as.data.frame(state.x77))
fit_scale < scale_mod(fit)
fit_scale < scale_mod(fit, center = TRUE)
# With weights
fitw < lm(formula = Murder ~ Income * Illiteracy,
data = as.data.frame(state.x77),
weights = Population)
fitw_scale < scale_mod(fitw)
fitw_scale < scale_mod(fitw, center = TRUE, binary.input = "0/1")
# With svyglm
if (requireNamespace("survey")) {
library(survey)
data(api)
dstrat<svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
regmodel < svyglm(api00~ell*meals,design=dstrat)
regmodel_scale < scale_mod(regmodel)
regmodel_scale < scale_mod(regmodel, binary.input = "0/1")
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.