fitlm() with 0 intercept function returns different values for R2 betwen MATLAB 2020a and 2020b?
Show older comments
I am trying to find the coefficient of determination. I ran the same fitlm function in version 2020a and 2020b, but calling the 'Rsquared.Ordinary' variable gives me drastically different results.
2020a, R2 = 0.5432
2020b, R2 = -8.0637
Why are they different?
Here is the code I am using:
data =[1.8286, 2.0125; 2.5571, 2.3886; 2.0747, 2.3476; 1.6216, 2.0296;
4.6010, 2.4861; 2.6089, 2.4834; 2.0093, 2.5387; 2.4757, 2.5660;
2.5475, 2.6642; 2.4854, 2.6650];
mdl = fitlm(data(:,1), data(:,2),'Intercept',false);
R2 = mdl.Rsquared.Ordinary;
Accepted Answer
More Answers (0)
Categories
Find more on Multirate Signal Processing 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!