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

3 ビュー (過去 30 日間)
Jack
Jack 2015 年 3 月 3 日
編集済み: Jack 2015 年 3 月 3 日
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 件)

カテゴリ

Help Center および File ExchangeLinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by