I'm getting a different error variance than regress...
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi All, I'm confused about how the error variance is computed in regress. Why is STATS(4) sometimes larger than var(Y)? Why isn't it always equal to var(Resid)?
clear all;clc;
X=rand(100,3);
Y=rand(100,1);
[B,BINT,R,RINT,STATS] = regress(Y,[ones(size(X,1),1),X]);
varY=var(Y);
varResid=var(Y'-B'*[ones(size(X,1),1),X]');
disp(['var(Y) = ' num2str(varY)]);
disp(['var(Resid) = ' num2str(varResid)]);
disp(['STATS(4) = ' num2str(STATS(4))]);
thanks!
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!