I'm getting a different error variance than regress...
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!