Negative R² when computing statistics in regress-function
Show older comments
I'm using the regress function to calculate the regression factor and would like to take a look at the R².
[b,bint,r,rint,stats] = regress(y,X)
Stats should provide the R² and other statistical values. In my case R² is negative, which makes no sense for me. The help tells me "When computing statistics, X should include a column of 1s so that the model contains a constant term."
I don't know how this should look like...my data are just 2 columns. Should I just add an extra column in X with only 1s?? Does someone know what this means and why I have to do that?!
Thanks for any help, Andreas
Accepted Answer
More Answers (0)
Categories
Find more on Linear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!