Learn R Programming

reghelper (version 0.3.3)

beta.lm: Standardized coeffients of a model.

Description

beta.lm returns the summary of a linear model where all variables have been standardized.

Usage

# S3 method for lm
beta(model, x = TRUE, y = TRUE, skip = NULL, ...)

# S3 method for aov beta(model, x = TRUE, y = TRUE, skip = NULL, ...)

Arguments

model

A fitted linear model of type 'lm'.

x

Logical. Whether or not to standardize predictor variables.

y

Logical. Whether or not to standardize criterion variables.

skip

A string vector indicating any variables you do not wish to be standarized.

...

Not currently implemented; used to ensure consistency with S3 generic.

Value

Returns the summary of a linear model, with the output showing the beta coefficients, standard error, t-values, and p-values for each predictor.

Details

This function takes a linear regression model and standardizes the variables, in order to produce standardized (i.e., beta) coefficients rather than unstandardized (i.e., B) coefficients.

Unlike similar functions, this function properly calculates standardized estimates for interaction terms (by first standardizing each of the individual predictor variables).

See Also

beta.glm

Examples

Run this code
# NOT RUN {
# iris data
model1 <- lm(Sepal.Length ~ Petal.Length + Petal.Width, iris)
beta(model1)  # all three variables standardized

model2 <- lm(Sepal.Width ~ Petal.Width + Species, iris)
beta(model2, skip='Species')  # all variables except Species standardized
# }

Run the code above in your browser using DataLab