Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Regression coefficients are the constant that indicate the rate of change in one variable as a function of change in another. Standardised regression coefficients are the same, but refer to a change in number of standard deviations.

Using LinearModelFit and the "ParameterTable" property I am able to obtain unstandardised regression coefficients (parameter estimates), but I would like to know if there is a also a way to quickly obtain standardised regression coefficients.

What I am currently doing:

model = LinearModelFit[data, x, x]
model["ParameterTable"]
share|improve this question
1  
Could you please add the definition of "standardised regression coefficients"? –  belisarius Feb 14 '13 at 17:35
    
@belisarius Done! –  ダンボー Feb 14 '13 at 18:56

1 Answer 1

up vote 9 down vote accepted

There does not seem to be any way to obtain the betas directly from model, but we can compute them without having to re-fit anything.

A linear model fit is of the form $y = X b$ for a response vector $y$, design matrix $X$, and estimated coefficients $b$. By definition, the standardized coefficients $\beta$ are obtained by first rescaling the columns of $X$ to have unit variance and rescaling (and recentering) $y$ also to have unit variance and performing the fit. If column $i$ of $X$ (written $x_i$) has standard deviation $s_i$ and $y$ has SD $s_y$, then the usual fit is

$$y = \sum_i b_i x_i$$

and the standardized fit is of the form

$$y/s_y = \sum_i \beta_i \frac{x_i}{s_i}$$

Comparing the two expressions yields

$$\beta_i = b_i \frac{s_i}{s_y}.$$

The Mathematica calculation of this is

model["BestFitParameters"] / StandardDeviation[model["Response"]] ( 
  StandardDeviation /@ Transpose[model["DesignMatrix"]])

(When the model includes a constant, the $\beta$ for it will necessarily equal $0$.)

share|improve this answer
1  
Thanks for the definition :) –  belisarius Feb 14 '13 at 18:41
1  
Since StandardDeviation[] acts on columns of a matrix (it acts like Total[] in this regard), one could replace StandardDeviation /@ Transpose[model["DesignMatrix"]] with StandardDeviation[model["DesignMatrix"]]. –  J. M. May 7 '13 at 1:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.