std.coef | R Documentation |
This function computes standardized coefficients for linear models estimated by using the lm()
function.
std.coef(model, print = c("all", "stdx", "stdy", "stdyx"), digits = 3, p.digits = 3,
write = NULL, append = TRUE, check = TRUE, output = TRUE)
model |
a fitted model of class |
print |
a character vector indicating which results to show, i.e. |
digits |
an integer value indicating the number of decimal places to be used for displaying results. |
p.digits |
an integer value indicating the number of decimal places to be used for displaying the p-value. |
write |
a character string naming a file for writing the output into
either a text file with file extension |
append |
logical: if |
check |
logical: if |
output |
logical: if |
The slope \beta
can be standardized with respect to only x
, only y
, or both y
and x
:
StdX(\beta_1) = \beta_1 SD(x)
StdX(\beta_1)
standardizes with respect to x
only and is interpreted as the change in
y
when x
changes one standard deviation referred to as SD(x)
.
StdY(\beta_1) = \frac{\beta_1}{SD(x)}
StdY(\beta_1)
standardizes with respect to y
only and is interpreted as the change in
y
standard deviation units, referred to as SD(y)
, when x
changes one unit.
StdYX(\beta_1) = \beta_1 \frac{SD(x)}{SD(y)}
StdYX(\beta_1)
standardizes with respect to both y
and x
and is interpreted as the change
in y
standard deviation units when x
changes one standard deviation.
Note that the StdYX(\beta_1)
and the StdY(\beta_1)
standardizations are not suitable for the
slope of a binary predictor because a one standard deviation change in a binary variable is generally
not of interest (Muthen, Muthen, & Asparouhov, 2016).
The standardization of the slope \beta_3
in a regression model with an interaction term uses the
product of standard deviations SD(x_1)SD(x_2)
rather than the standard deviation of the product
SD(x_1 x_2)
for the interaction variable x_1
x_2
(see Wen, Marsh & Hau, 2010). Likewise,
the standardization of the slope \beta_3
in a polynomial regression model with a quadratic term
uses the product of standard deviations SD(x)SD(x)
rather than the standard deviation of the
product SD(x x)
for the quadratic term x^2
.
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
model |
model specified in |
args |
specification of function arguments |
result |
list with result tables, i.e., |
Takuya Yanagida takuya.yanagida@univie.ac.at
Muthen, B. O., Muthen, L. K., & Asparouhov, T. (2016). Regression and mediation analysis using Mplus. Muthen & Muthen.
Wen, Z., Marsh, H. W., & Hau, K.-T. (2010). Structural equation models of latent interactions: An appropriate standardized solution and its scale-free properties. Structural Equation Modeling: A Multidisciplinary Journal, 17, 1-22. https://doi.org/10.1080/10705510903438872
#----------------------------------------------------------------------------
# Linear model
# Example 1: Regression model with continuous predictors
mod.lm1 <- lm(mpg ~ cyl + disp, data = mtcars)
std.coef(mod.lm1)
# Example 2: Print all standardized coefficients
std.coef(mod.lm1, print = "all")
# Example 3: Regression model with dichotomous predictor
mod.lm2 <- lm(mpg ~ vs, data = mtcars)
std.coef(mod.lm2)
# Example 4: Regression model with continuous and dichotomous predictors
mod.lm3 <- lm(mpg ~ disp + vs, data = mtcars)
std.coef(mod.lm3)
# Example 5: Regression model with continuous predictors and an interaction term
mod.lm4 <- lm(mpg ~ cyl*disp, data = mtcars)
std.coef(mod.lm4)
# Example 6: Regression model with a quadratic term
mod.lm5 <- lm(mpg ~ cyl + I(cyl^2), data = mtcars)
std.coef(mod.lm5)
## Not run:
#----------------------------------------------------------------------------
# Example 7: Write Results into a Text of Excel file
# Example 7a: Text file
std.coef(mod.lm1, write = "Std_Coef.txt", output = FALSE, check = FALSE)
# Example 7b: Excel file
std.coef(mod.lm1, write = "Std_Coef.xlsx", output = FALSE, check = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.