std.coef {misty} | R Documentation |
Standardized Coefficients
Description
This function computes standardized coefficients for linear models estimated by using the lm()
function.
Usage
std.coef(model, print = c("all", "stdx", "stdy", "stdyx"), digits = 3, p.digits = 4,
write = NULL, append = TRUE, check = TRUE, output = TRUE)
Arguments
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 text file with file extension
|
append |
logical: if |
check |
logical: if |
output |
logical: if |
Details
The slope can be standardized with respect to only
, only
, or both
and
:
standardizes with respect to
only and is interpreted as the change in
when
changes one standard deviation referred to as
.
standardizes with respect to
only and is interpreted as the change in
standard deviation units, referred to as
, when
changes one unit.
standardizes with respect to both
and
and is interpreted as the change
in
standard deviation units when
changes one standard deviation.
Note that the and the
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 in a regression model with an interaction term uses the
product of standard deviations
rather than the standard deviation of the product
for the interaction variable
(see Wen, Marsh & Hau, 2010). Likewise,
the standardization of the slope
in a polynomial regression model with a quadratic term
uses the product of standard deviations
rather than the standard deviation of the
product
for the quadratic term
.
Value
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., |
Author(s)
Takuya Yanagida takuya.yanagida@univie.ac.at
References
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
Examples
dat <- data.frame(x1 = c(3, 2, 4, 9, 5, 3, 6, 4, 5, 6, 3, 5),
x2 = c(1, 4, 3, 1, 2, 4, 3, 5, 1, 7, 8, 7),
x3 = c(0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1),
y = c(2, 7, 4, 4, 7, 8, 4, 2, 5, 1, 3, 8))
#-------------------------------------------------------------------------------
# Linear model
# Example 1: Regression model with continuous predictors
mod.lm1 <- lm(y ~ x1 + x2, data = dat)
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(y ~ x3, data = dat)
std.coef(mod.lm2)
# Example 4: Regression model with continuous and dichotomous predictors
mod.lm3 <- lm(y ~ x1 + x2 + x3, data = dat)
std.coef(mod.lm3)
# Example 5: Regression model with continuous predictors and an interaction term
mod.lm4 <- lm(y ~ x1*x2, data = dat)
# Example 6: Regression model with a quadratic term
mod.lm5 <- lm(y ~ x1 + I(x1^2), data = dat)
std.coef(mod.lm5)
#-------------------------------------------------------------------------------
# Example 7: Write Results into an Excel file
## Not run:
mod.lm1 <- lm(y ~ x1 + x2, data = dat)
std.coef(mod.lm1, write = "Std_Coef.xlsx", output = FALSE)
result <- std.coef(mod.lm1, output = FALSE)
write.result(result, "Std_Coef.xlsx")
## End(Not run)