www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xreglinear/gui_diagstats.m
function varargout= gui_diagstats(m,Action,varargin) % GUI_DIAGSTATS % % GUI Tool for displaying ANOVA Table and other Statistics % This is based on the statistics calculated by % s = stats(m,'stepwise'). % % See also xreglinear/STATS % Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. switch lower(Action) case 'create' % create tool varargout{1}=i_Create(varargin{:}); case 'display' % Update Table Values i_Display(m,varargin{:}); case 'nofit' i_NoFit(m,varargin{:}); case 'id' varargout{1}='xreglinear'; end function Tool= i_Create(hFig) % Anova Table Tool.layout = mbcgui.container.layoutpanel(... 'Parent', hFig, ... 'Visible', 'off', ... 'BorderType', 'etchedin', ... 'Title', 'Anova table'); Stbl = mbcwidgets.Table2D( 'Parent', Tool.layout,... 'ShowHeaderSelection', false,... 'Editable', false ); Stbl.Peer.setColumnData( {'SS','df','MS'} ); Stbl.Peer.setRowData( {'Regression','Error','Total'} ); Stbl.Peer.setCornerString( 'Source' ); Stbl.Peer.setRowHeaderWidth( 100 ); Tool.Anova=Stbl; L = xreglayerlayout(Tool.layout, 'border', [5 5 5 5], 'elements', {Stbl}); set(Tool.layout, 'LayoutComponent', {L}); function i_Display(Model,Tool) anova = AnovaTable(Model); % Display Anova Table Tool.Anova.Peer.setTableData( anova(:,1:3) ); function i_NoFit(m,Tool) dfTot = size(m.Store.X,1)-IncludeConst(m); dfe= dferror(m); tabledata = NaN(3,3); tabledata(:,2)= [dfTot-dfe dfe dfTot]'; Tool.Anova.Peer.setTableData( tabledata );