7
$\begingroup$

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"]
$\endgroup$
  • 1
    $\begingroup$ Could you please add the definition of "standardised regression coefficients"? $\endgroup$ – Dr. belisarius Feb 14 '13 at 17:35
  • $\begingroup$ @belisarius Done! $\endgroup$ – ダンボー Feb 14 '13 at 18:56
9
$\begingroup$

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$.)

$\endgroup$
  • 1
    $\begingroup$ 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"]]. $\endgroup$ – J. M. will be back soon May 7 '13 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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