필터 지우기
필터 지우기

One r2 for each beta column/predictor

조회 수: 1 (최근 30일)
Nuchto
Nuchto 2012년 7월 10일
Hi,
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

채택된 답변

Greg Heath
Greg Heath 2012년 7월 12일
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.
Greg
  댓글 수: 1
Nuchto
Nuchto 2012년 7월 14일
Thanks, this is what I was looking for, except... I can't find 'r2' from any of the outputs of stepwisefit!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mark Whirdy
Mark Whirdy 2012년 7월 10일
Hi Nuchto
No, you're correct - its the R^2 of the overall model that is output as stats(1).
Kind Rgds, Mark
  댓글 수: 5
Mark Whirdy
Mark Whirdy 2012년 7월 11일
편집: Mark Whirdy 2012년 7월 11일
Hi Nuchto
y = b1*x1 + b2*x2 + b3*x3
Beta's are coefficients of the predictor X variables, so by definition there must be as many coefficients as variables (plus an optional intercept). How would you calculate a "single model beta" number?
The R^2 on the other hand refers more to the predicted Y variable than to the predictor X variables (at least its helpful at the start maybe to think of it like this), describing how much of Y's variance is explained by your model. Lets say its 69%, then 69% of its variance is explained. What would an R^2 like [45% 36% 54%] mean - how much of Y is your model explaining then? ... you don't know. (i.e. for the concept of model explanatory power to have meaning it must be a single number). 3 individual R^2 will be the explanatory power of 3 individual univariate models respectively then - its useful/interesting information, but doesn't describe the overall 3-variable model as such.
This isn't a pecularity of matlab really but more concepts around linear regression itself.
Does this make sense at all?
Kind Rgds, Mark
Nuchto
Nuchto 2012년 7월 11일
편집: Nuchto 2012년 7월 11일
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?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by