Azzera filtri
Azzera filtri

I'm getting a different error variance than regress...

1 visualizzazione (ultimi 30 giorni)
Jack
Jack il 3 Mar 2015
Modificato: Jack il 3 Mar 2015
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!

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by