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;