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

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

%   Copyright 2006-2007 The MathWorks, Inc.

% Can only get stats if fitted already
error( obj.pAssertNotBeingEdited() );
error( obj.pAssertIsFitted() );

mdl= obj.Object;

[x, y] = pGetData(obj);

% summary stats
Wc = CalcWeights(mdl,x);
[data,Names] = FitSummary(mdl,x,y,Wc);

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