www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@abstractresponse/SummaryStatistics.m

    function S= SummaryStatistics(R,Stats)
%SUMMARYSTATISTICS Calculate summary statistics of model fit.
%
%   SS = SUMMARYSTATISTICS( RESPONSE ) returns a structure array containing
%   Statistics and Names fields for the model M.
%
%   SS = SUMMARYSTATISTICS( RESPONSE, NAMES ) returns an array of the statistics
%   specified by NAMES. NAMES can be a char array, or a cell array of
%   strings.
%
% See also mbcmodel.abstractresponse.AlternativeModelStatistics,
% mbcmodel.response.DiagnosticStatistics, mbcmodel.model.SummaryStatistics 

%   Copyright 2004-2006 The MathWorks, Inc.

data= statistics(R.Object);
Names = colhead(R.Object);



if nargin>1
    % select some of the statistics
    [ism,ind]= ismember(Stats,Names);
    if ~all(ism)
        error(message('mbc:mbcmodel:abstractresponse:InvalidProperty1'));
    end
    % only return data
    S= data(:,ind);
else
    % structure
    S.Statistics = data;
    S.Names= Names;
end