CORRCOEF confusion with zero intercept linear regression
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2014-3-14
I must be missing something here. How could you get a negative R^2?
What are you doing?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!