Monday, November 15, 2010

Example 8.14: generating standardized regression coefficients

Standardized (or beta) coefficients from a linear regression model are the parameter estimates obtained when the predictors and outcomes have been standardized to have variance = 1. Alternatively, the regression model can be fit and then standardized post-hoc based on the appropriate standard deviations. The parameters are thus interpreted as change in the outcome, in standard deviations, per standard deviation change in the predictors. However they're calculated, standardized coefficients facilitate an assessment of which variables have the greatest association with the outcome (or response) variable, though such an assessment ignores the confidence limits associated with each pairwise association.

It's straightforward to calculate these quantities in SAS and R. We'll demonstrate with data from the HELP study, modeling PCS as a function of MCS and homelessness among female subjects.


In SAS, standardized coefficients are available as the stb option for the model statement in proc reg.

proc reg data="c:\book\help";
where female eq 1;
model pcs = mcs homeless / stb;
The REG Procedure
Model: MODEL1
Dependent Variable: PCS

Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|

Intercept 1 39.62619 2.49830 15.86 <.0001
MCS 1 0.21945 0.07644 2.87 0.0050
HOMELESS 1 -2.56907 1.95079 -1.32 0.1908

Parameter Estimates
Variable DF Estimate

Intercept 1 0
MCS 1 0.26919
HOMELESS 1 -0.12348

In R we demonstrate the use of the lm.beta() function in the QuantPsyc package (due to Thomas D. Fletcher of State Farm). The function is short and sweet, and takes a linear model object as argument:

function (MOD)
b <- summary(MOD)$coef[-1, 1]
sx <- sd(MOD$model[-1])
sy <- sd(MOD$model[1])
beta <- b * sx/sy

Here we apply the function to data from the HELP study.

ds = read.csv("")
female = subset(ds, female==1)
lm1 = lm(pcs ~ mcs + homeless, data=female)

The results, in terms of unstandardized regression parameters are the same as in SAS:

> summary(lm1)

lm(formula = pcs ~ mcs + homeless, data = female)

Min 1Q Median 3Q Max
-28.163 -5.821 -1.017 6.775 29.979

Estimate Std. Error t value Pr(>|t|)
(Intercept) 39.62619 2.49830 15.861 < 2e-16 ***
mcs 0.21945 0.07644 2.871 0.00496 **
homeless -2.56907 1.95079 -1.317 0.19075
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 9.761 on 104 degrees of freedom
Multiple R-squared: 0.0862, Adjusted R-squared: 0.06862
F-statistic: 4.905 on 2 and 104 DF, p-value: 0.009212

To generate the standardized parameter estimates, we use the lm.beta() function.


This generates the following output:

mcs homeless
0.2691888 -0.1234776

A change in 1 standard deviation of MCS has more than twice the impact on PCS than a 1 standard deviation change in the HOMELESS variable. This example points up another potential weakness of standardized regression coefficients, however, in that the homeless variable can take on values of 0 or 1, and a 1 standard deviation change is hard to interpret.


Mark M. Fredrickson said...

Regarding the interpretation problem at the end, Andrew Gelman makes a compelling argument for standardizing variables by 2 standard deviations so that the variance is similar to a binary variable (provided p is not too far from 0.5):

The arm package implements a standardize() function that appears to work similarly to lm.beta.

Ken Kleinman said...

I think it would make more sense to only standardize the continuous ones-- 2sd makes sense for them. I would leave the categorical covars as is, and also would not touch the outcome.

Anonymous said...

Just curious, what is the rationale/support for the statement: "such an assessment ignores the confidence limits associated with each pairwise association"? Cheers!

Saz said...

May I ask, how to get 95% confidence interval from standardized coefficients obtained from linear regression?

Nick Horton said...

You can run "Make.Z()" in the QuantPsyc package to convert your data (then lm() would do this for you automatically).