CORRCOEF confusion with zero intercept linear regression

4 views (last 30 days)
I want to do a simple linear regression and compare the R^2 correlation coefficient when the intercept is allowed to vary and when the intercept is forced to be zero. I am happy that I am correctly determining the coefficients and using them to calculate the y-values for the best-fit lines (they plot as I would expect).
I then use CORRCOEF to calculate the R value for the fit between the original y data and (a) the y data with the variable intercept; and (b) the y data with the zero intercept. However, I am getting exactly the same R value for both sets of predicted y values - despite the fact that the non-zero intercept line is visibly a much better fit to the data.
When I calculate R^2 by the individual steps outlined in the linear regression section of the documentation I get different values - the R^2 value for the non-zero intercept line being the square of the value I get from CORRCOEF.
Can anyone explain why CORRCOEF is giving me the same R value for both the zero and non-zero intercept predictions? I apologise if this is a dumb question, but I'm very much a novice for both MATLAB and the joys of statistical analysis.
More generally, if I have a negative R^2 value (derived from the step-wise calculation rather than CORRCOEF) is it normal practice to quote it as zero or to give the calculated negative value?
Thanks you.
  1 Comment
Star Strider
Star Strider on 14 Mar 2014
I must be missing something here. How could you get a negative R^2?
What are you doing?

Sign in to comment.

Answers (0)

Categories

Find more on Descriptive Statistics in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!