One r2 for each beta column/predictor

3 views (last 30 days)
The 'stats' output from regress returns a 1x4 vector, first value of which is r2. If you do regress(Y,X) where X is not one column vector, but a matrix of predictors (columns), then you would get as many beta columns as predictors, am I right?
Would you also get as many r2 as beta columns (or predictors)? Because I am only getting one r2 for X and Y, even though X is not one predictor, but many. Is this correct? Or am I indexing wrongly the stats output and missing data?
Thank you all

Accepted Answer

Greg Heath
Greg Heath on 12 Jul 2012
With n points and p predictors you get p+1 betas (b0,b1,...bp) and a R^2 quantifying prformance
For any subset of predictors the corresponding R^2 will be less.
Although there is no universally accepted way to divide R^2 p+1 ways and attribute each part to a single predictor, I am satisfied to use the function stepwisefit in the backward mode to obtain such a result.
help stepwisefit
doc stepwisefit
Hope this helps.
  1 Comment
Nuchto on 14 Jul 2012
Thanks, this is what I was looking for, except... I can't find 'r2' from any of the outputs of stepwisefit!

Sign in to comment.

More Answers (1)

Mark Whirdy
Mark Whirdy on 10 Jul 2012
Hi Nuchto
No, you're correct - its the R^2 of the overall model that is output as stats(1).
Kind Rgds, Mark
Nuchto on 11 Jul 2012
Edited: Nuchto on 11 Jul 2012
Thanks for your explanation. When I said "if we wanted just one beta value, we would run regress with one predictor at a time", I meant that only with one predictor you get one beta, obviously. Indeed, the r2 is the proportion of variance that the model accounts for. But can't this be broken down to the specific contributions of each predictor? That is what I was asking. I know it makes sense to get the overall percentage of the whole model's contribution to Y, but also what is the contribution of each predictor in terms of r2?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!