www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodel/InitModel.m
function [m,OK]= InitModel(m,x,y,Wc,IsCoded,varargin) %INITMODEL default initmodel method (initialises pev) % % [m,OK]= InitModel(m,x,y); % coded data assumed % [m,OK]= InitModel(m,x,y,Wc); % coded data assumed. Use Wc=[] to % specify no weights % [m,OK]= InitModel(m,x,y,Wc,IsCoded); % specify whether data is coded or % uncoded. % Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin<4 Wc = []; end if nargin>4 && ~IsCoded % raw data used [x,y]= checkdata(m,x,y); end J= CalcJacob(m,x); if ~isempty(Wc) J = Wc*J; end [J,P]=xregprecond(J); [Q,R,OK]= xregqr(J); if OK % initialise var info r= y-eval(m,x); df= length(y)-numParams(m); s2= sum(r.*r)/df; ri= (P/R)*sqrt(s2); m= var(m,ri,s2,df); end