www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdev_local/makemlerf.m
function mdev= makemlerf(mdev,Diags) %MAKEMLERF make children nodes into mlerfs for mle models % % mdev= makemlerf(mdev,Diags) % Diags is structure containing mle diagnostic statistics % Copyright 2000-2006 The MathWorks, Inc. and Ford Global Technologies, Inc. TS= BestModel(mdev); if ~isempty(TS) && ismle(TS) L= model(mdev); G= get(TS,'global'); TSmle= mdev.MLE.Model; D= cov(TSmle); if nargin<2 if mdev.IsLinearised [X,Y]= LinearisedData(mdev,IsTimeVarying(mdev),false); [twoStage, Diags]= glsresults(TSmle, X, Y); else [Xg,Yrf,Sigma]= mledata(mdev,0,mdev.MLE.Modes(2)); Diags= diagnosticStats(TSmle,Xg,Yrf,Sigma); end end % Diags= struct('Observed',Yrf,'Yhat',P,'Residuals',e,'SResiduals',VarE); ch= children(mdev,RFstart(L)+mdev.ResponseFeatures(BMIndex(mdev),:)); for i=1:length(ch) DS= struct('Observed',Diags.Observed(:,i),... 'Yhat',Diags.Yhat(:,i),... 'Residuals',Diags.Residuals(:,i),... 'SResiduals',Diags.SResiduals(:,i)); % set up pev matrix for rf model [ri,s2,df]= var(ch(i).model); if s2~=0 ri= ri*sqrt(D(i,i)/s2); G{i}= var(G{i},ri,D(i,i),df); end % make mle response feature ch(i).mdevmlerf(G{i},DS); ch(i).status(2,0); end mbH= MBrowser; if isBrowserProject(mdev,mbH) try mbH.doDrawTree(ch) end end else % turn back into modeldev children(mdev,@modeldev); children(mdev,mdev.ResponseFeatures(BMIndex(mdev),:)+RFstart(model(mdev)),@status,2,0); mbH= MBrowser; if isBrowserProject(mdev,mbH) try mbH.doDrawTree(children(mdev)) end end end