www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@response/DiagnosticStatistics.m
function S= DiagnosticStatistics(R,TestNumbers,Stats) %DIAGNOSTICSTATISTICS Calculate diagnostic statistics for the response. % % S = DIAGNOSTICSTATISTICS( RESPONSE ) % S = DIAGNOSTICSTATISTICS( RESPONSE, TESTNUMBERS ) % S = DIAGNOSTICSTATISTICS( RESPONSE, TESTNUMBERS, STATS ) % % See also mbcmodel.abstractresponse.SummaryStatistics % Copyright 2004-2011 The MathWorks, Inc. m= model(R.Object); NeedsInit= isa(m,'xreglinear') && isempty(get(m,'store')) || length(fieldnames(get(m,'store')))==1; if NeedsInit InitModel(R.Object); end [~,~,DataOK]= FitData(R.Object); [stats, Names]= diagnosticStats(R.Object); data = zeros(length(DataOK),length(Names)); data(DataOK,:)= stats; % removed data data(~DataOK,:)= NaN; if NeedsInit cleanup(R.Object); end if nargin>1 % select tests data= data(TestNumbers,:); end if nargin>2 if ischar(Stats) Stats= {Stats}; end ind= zeros(1,length(Stats)); for i=1:length(Stats) % do a strmatch ignoring case c= find( strncmpi( Stats{ i },Names,length(Stats{ i }) ) ); if isempty(c) error(message('mbc:mbcmodel:response:InvalidProperty')); elseif ~isscalar(c) % nonunique property return the first one ind(i)= c(1); warning(message('mbc:mbcmodel:response:AmbiguousProperty', Stats{ i }, Names{ c( 1 ) })); else ind(i)= c; end end % only return data S= data(:,ind); else % structure S.Statistics = data; S.Names= Names; end