plotregression fitlm rsquare difference

Hello
Could you help explain why there is a difference between r-squared calculated using plotregression() and fitlm()?
R-squared: 0.968 from fitlm() R = 0.98364 from plotregression()
The code to produce the two r-squared values is below.
%% set up variable from neural network output = net(input); outputTest = output(tr.testInd); targetTest = target(tr.testInd);
%% first method to produce r-squared plotregression(targetTest,outputTest,'Testing')
%% second method to produce r-squared mdl = fitlm(targetTest,outputTest); r2 = mdl.Rsquared.Ordinary;
Regards
William Bell

 Accepted Answer

>> 0.98364^2
ans =
0.9675
Thank you for formally accepting my answer
Greg

More Answers (0)

Community Treasure Hunt

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

Start Hunting!