www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@localmod/basicstats.m
function s= basicstats(L,X,y,Wc) %BASICSTATS localmod statistics % % s= basicstats(L,X,y,Wc) % Copyright 2000-2006 The MathWorks, Inc. and Ford Global Technologies, Inc. % sse SSE % df nobs-p % ssen natural SSE % R2 % cond(J) condition of jacobian [r,J,yhat]= lsqcost(L,X,y,Wc); sse = sum(r.^2); % Residual sum of squares. sst = sum((y-mean(y)).^2); % Total sum of squares. ssr = sst-sse; nobs = length(y); p = numParams(L); if nobs>p mse = sse/(nobs-p); else mse = 0; end if sst==0 R2= 1; else R2 = ssr/sst; end rn= CalcYinv(L,y) - CalcYinv(L,yhat); % rn= rn(isfinite(rn)); if ~isreal(rn) rn(imag(rn)~=0)=[]; end ssen = sum(rn.^2); s.sse = sse; s.SSE_natural = ssen; s.df = nobs-p; s.nobs = nobs; s.R2 = R2; s.mse = mse;