www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xreginterprbf/diagnosticStats.m

    function [data,factors,specialPlots,olIndex] = diagnosticStats(m,X,Y)
%DIAGNOSTICSTATS Stats for diagnostic plots
%Res
%   [data,factors,specialPlots] = DIAGNOSTICSTATS(m)
%   This is an overloaded function to return stats and factors for the
%   diagnostic plots

%  Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.


[Xm,Ym] = checkdata(m,X,Y);
Xm = invcode(m,Xm);
yhat = EvalModel(m,Xm);
% Plot indexes.
obs = (1:length(Ym))';
data = [obs,...
    yhat,...
    Ym-yhat,...
    Ym,...
    Xm];

% This returns the names of the statistics
% sname= get(X,'name');
% snameY= p.name;
sname = InputLabels(m);
snameY= ResponseLabel(m);
% make it a row
[r,c]= size(sname);
if r>c
    sname= sname';
end
output= getOutput(m);
if ~isempty(output.Units)
    u = sprintf(' [%s]',output.Units);
else
    u = '';
end
factors={'Obs. number',...
    ['Predicted ',snameY],...
    ['Residuals',u],...
    snameY};

factors= [factors,sname];

% This is a list of special plots. This can be empty
specialPlots= {};

% outlier index
olIndex= outliers(m,data,factors);