亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sur.m

?? 用于做統計分析的matlab 程序包,各種基本統計分析的函數都有
?? M
字號:
function result = sur(neqs,y,x,iflag,info)
% PURPOSE: computes seemingly unrelated regression estimates
%          for a model with neqs-equations
%---------------------------------------------------
% USAGE:    results = sur(neqs,y,x,iflag,info)
%       or, results = sur(neqs,y,x) (for no iteration)
% where: 
%      neqs  = # of equations
%        y   = an 'eq' structure containing dependent variables 
%              e.g. y(1).eq = y1; y(2).eq = y2; y(3).eq = y3;
%        x   = an 'eq' structure containing explanatory variables
%                 e.g. x(1).eq = [iota x1 x4]; 
%                      x(2).eq = [iota x1]; 
%                      x(3).eq = [iota x1 x2 x5];
%      iflag = 1 for iteration on error covariance matrix, 
%              0 for no iteration (0 = default) 
%       info = a structure for iteration options:
%              info.itmax = maximum # of iterations (default = 100)
%              info.crit  = convergence criterion  for bhat change   
%                           (default = 0.001)                             
%---------------------------------------------------
%        NOTE:  x(i), i=1,...,G should include a constant vector
%               if you want one in the equation
%---------------------------------------------------
% RETURNS a structure:
%   result.meth      = 'sur'
%   result(eq).beta  = bhat for each equation            
%   result(eq).tstat = tstat for each equation            
%   result(eq).tprob = tprobs for each equation        
%   result(eq).resid = residuals for each equation      
%   result(eq).yhat  = yhats for each equation         
%   result(eq).y     = y for each equation             
%   result(eq).rsqr  = r-squared for each equation     
%   result(eq).rbar  = r-squared adj for each equation  
%   result(eq).nvar  = nvar in each equation     
%   result(eq).sige  = e'e/nobs for each equation 
%   result(eq).dw    = Durbin-Watson 
%   result.srsqr     = system-wide R-squared
%   result.nobs      = nobs 
%   result.neqs      = neqs
%   result.sigma     = sig(i,j) across equations
%   result.ccor      = cross-equation correlation matrix
%   result.iter      = # of iterations if iflag = 1, or 0 
%   result.convg     = convergence change in bhat estimates
% --------------------------------------------------
% SEE ALSO: prt(), prt_eqs(), plt()
%---------------------------------------------------

% written by:
% James P. LeSage, Dept of Economics
% University of Toledo
% 2801 W. Bancroft St,
% Toledo, OH 43606
% jpl@jpl.econ.utoledo.edu

if nargin == 3
itflag = 0;
icnt = 0;
elseif nargin == 4
itflag = iflag;
itmax = 100;
crit = 0.001;
elseif nargin == 5
 if ~isstruct(info)
 error('sur requires a structure for iteration options');
 end;
itmax = 100;
crit = 0.001;
itflag = 1;
fields = fieldnames(info);
nf = length(fields);
for i=1:nf
    if strcmp(fields{i},'itmax')
        itmax = info.itmax; 
    elseif strcmp(fields{i},'crit')
        crit = info.crit;
    end;
end;

else
error('Wrong # of arguments to sur'); 
end;

result.meth = 'sur';
result.neqs = neqs;

% error checking on input of structures
if ~isstruct(y)
error('sur requires a structure for y as input');
end;

if ~isstruct(x)
error('sur requires a structure for x as input');
end;

% find the # of equations
chk = fieldnames(y);
if (strcmp(chk,'eq') ~= 1)
error('Use eq as the fieldname for y');
end;

chk = fieldnames(x);
if (strcmp(chk,'eq') ~= 1)
error('Use eq as the fieldname for x');
end;

nobs = length(y(1).eq);
result.nobs = nobs;

% error checking that all equations contain the same # of observations
nobsy = zeros(neqs,1);
nobsx = zeros(neqs,1);
for i=1:neqs;
[nobsy(i,1) junk] = size(y(i).eq);
result(i).y = y(i).eq; % fill-in y-vectors
[nobsx(i,1) result(i).nvar] = size(x(i).eq); % fill-in nvar for each equation
end;

tst = find(nobsy ~= nobsx);
if length(tst) ~= 0
error('sur only handles same # obs for all equations');
end;

% fill-in initial sigma matrix using ols
emat = zeros(nobs,neqs);
for i=1:neqs;
emat(:,i) = olse(y(i).eq,x(i).eq);
end;

sigma = zeros(neqs,neqs);
for i=1:neqs;
 for j=i:neqs;
    sigma(i,j) = (emat(:,i)'*emat(:,j))/nobs;
    if j > 1;
  sigma(j,i) = sigma(i,j);
    end;
end;
end;

sigmai = inv(sigma); % find sigma-inverse
% fill-in sig*(x'x) matrix
nx = 0;              % total number of x-variables in all equations
nxi = zeros(neqs,1); % left dimension of xx

for i=1:neqs;
 nx = nx + result(i).nvar;
 nxi(i,1) = result(i).nvar;
end;

nxj = nxi'; % right dimension of xx
xx = zeros(nx,nx);
si = 1;
sj = 1;
for i=1:neqs;
 for j=1:neqs;
  xx(si:si+nxi(i,1)-1,sj:sj+nxj(1,j)-1) = sigmai(i,j)*(x(i).eq'*x(j).eq);
  sj = sj+nxj(1,j);
 end;
 si = si+nxi(i,1);
 sj = 1;
end;

xxi = inv(xx); % find xpx-inverse for inference

% fill-in xpy vector
si = 1;
sj = 1;
xy = zeros(nx,1);

for i=1:neqs;
 xp = x(i).eq';
 for j=1:neqs;
   yt = y(j).eq;
  xy(si:si+nxi(i,1)-1,1) = xy(si:si+nxi(i,1)-1,1) + sigmai(i,j)*xp*yt;
   end;
 si = si+nxi(i,1);
end;

switch itflag
case {0} % no iteration
icnt = 0;
% find bhat's
si = 1;
sj = 1;
for i=1:neqs;
 bhat = zeros(nxi(i,1),1);
 for j=1:neqs;
  xpy = xy(sj:sj+nxj(1,j)-1,1);
  xpxi = xxi(si:si+nxi(i,1)-1,sj:sj+nxj(1,j)-1);
  bhat = bhat + xpxi*xpy;
    sj = sj+nxj(1,j);
   end;
   % save bhat's
   result(i).beta = bhat;
 sj = 1;
 si = si+nxi(i,1);
end;

% compute sur residuals
emat = zeros(nobs,neqs);
for i=1:neqs;
 result(i).resid = y(i).eq - x(i).eq*result(i).beta;
 emat(:,i) = result(i).resid;
end;

% compute sur sigma
sigma = zeros(neqs,neqs);
for i=1:neqs;
 for j=i:neqs;
    sigma(i,j) = (emat(:,i)'*emat(:,j))/nobs;
    if j > 1;
  sigma(j,i) = sigma(i,j);
    end;
end;
end;

case {1} % iteration
convg = 1000;
icnt = 0;
while convg > crit

% find bhat's
si = 1;
sj = 1;
for i=1:neqs;
 bhat = zeros(nxi(i,1),1);
 for j=1:neqs;
  xpy = xy(sj:sj+nxj(1,j)-1,1);
  xpxi = xxi(si:si+nxi(i,1)-1,sj:sj+nxj(1,j)-1);
  bhat = bhat + xpxi*xpy;
    sj = sj+nxj(1,j);
   end;
   % save bhat's
   if icnt > 0
   bsave(i).beta = result(i).beta;
   end;
   result(i).beta = bhat;
 sj = 1;
 si = si+nxi(i,1);
end;


% compute sur residuals
emat = zeros(nobs,neqs);
for i=1:neqs;
 result(i).resid = y(i).eq - x(i).eq*result(i).beta;
 emat(:,i) = result(i).resid;
end;

% compute sur sigma
sigma = zeros(neqs,neqs);
for i=1:neqs;
 for j=i:neqs;
    sigma(i,j) = (emat(:,i)'*emat(:,j))/nobs;
    if j > 1;
  sigma(j,i) = sigma(i,j);
    end;
end;
end;

% check for convergence
if icnt > 0
 convg = 0.0;
 in8.fmt = '%16.8f';
  for i=1:neqs
  convg = convg + sum(abs(result(i).beta - bsave(i).beta));
  end;
end;


icnt = icnt + 1;
if icnt > itmax
warn('sur: more than %d iterations',itmax);
break;
end;


sigmai = inv(sigma); % find sigma-inverse
% fill-in sig*(x'x) matrix
nx = 0;              % total number of x-variables in all equations
nxi = zeros(neqs,1); % left dimension of xx

for i=1:neqs;
 nx = nx + result(i).nvar;
 nxi(i,1) = result(i).nvar;
end;

nxj = nxi'; % right dimension of xx
xx = zeros(nx,nx);
si = 1;
sj = 1;
for i=1:neqs;
 for j=1:neqs;
  xx(si:si+nxi(i,1)-1,sj:sj+nxj(1,j)-1) = sigmai(i,j)*(x(i).eq'*x(j).eq);
  sj = sj+nxj(1,j);
 end;
 si = si+nxi(i,1);
 sj = 1;
end;

xxi = inv(xx); % find xpx-inverse for inference

% fill-in xpy vector
si = 1;
sj = 1;
xy = zeros(nx,1);

for i=1:neqs;
 xp = x(i).eq';
 for j=1:neqs;
   yt = y(j).eq;
  xy(si:si+nxi(i,1)-1,1) = xy(si:si+nxi(i,1)-1,1) + sigmai(i,j)*xp*yt;
   end;
 si = si+nxi(i,1);
end;


end; % end of while statement for iteration


otherwise

end; % end of switch

result(1).ccor = corrcoef(emat); % return cross-equation correlations
result(1).sigma = sigma;         % return croos-equation covariances
sigmai = inv(sigma);

% compute sur var-cov matrix
xx = zeros(nx,nx);
si = 1;
sj = 1;
for i=1:neqs;
 for j=1:neqs;
  xx(si:si+nxi(i,1)-1,sj:sj+nxj(1,j)-1) = sigmai(i,j)*(x(i).eq'*x(j).eq);
  sj = sj+nxj(1,j);
 end;
 si = si+nxi(i,1);
 sj = 1;
end;

xxi = inv(xx); % find sur xpx-inverse for inference

result(1).xxi = xxi;

% compute t-statistics
vcov = diag(xxi);

si = 1;
for i=1:neqs;
 stdb = sqrt(vcov(si:si+nxi(i,1)-1,1));
 result(i).tstat = result(i).beta./stdb;
 result(i).resid = y(i).eq - x(i).eq*result(i).beta;
 si = si+nxi(i,1);
end;

% compute t-probabilities
for i=1:neqs;
 result(i).tprob = tdis_prb(result(i).tstat,nobs-nxi(i,1));
end;

% compute overall r-squared statistic
% see Green, 1997 page 679
ymean = zeros(neqs,1);
iota = ones(nobs,1);
for i=1:neqs;
 ymean(i,1) = mean(result(i).y);
end;

for i=1:neqs;
 for j=1:neqs;
  temp = (1/nobs)*(y(i).eq-ymean(i,1)*iota).*(y(j).eq-ymean(j,1)*iota);
  syy(i,j) = sum(temp);
  if j > i
   syy(j,i) = syy(i,j);
  end;
 end;
end;

sys_rsqr = 1 - neqs/trace(sigmai*syy);

% fill-in results for each equation
   for i=1:neqs;
   yd =  result(i).y - ones(nobs,1)*ymean(i,1);
   rsqr2 = yd'*yd;
   sigu = result(i).resid'*result(i).resid;
   result(i).rsqr = 1 - sigu/rsqr2;           % r-squared
   rsqr1 = sigu/(nobs-result(i).nvar);
   rsqr2 = rsqr2/(nobs-1.0);
   result(i).rbar = 1 - (rsqr1/rsqr2);        % r-bar squared
   result(i).srsqr = sys_rsqr;
 result(i).yhat = result(i).y - x(i).eq*result(i).beta;
 result(i).resid = result(i).y - result(i).yhat;
 sigu = result(i).resid'*result(i).resid;
 result(i).sige = sigu/nobs;                % sige's
   ediff = result(i).resid(2:nobs) - result(i).resid(1:nobs-1);
   result(i).dw = (ediff'*ediff)/sigu;           % durbin-watson 
end;

result(1).iter = icnt;
if itflag ~= 0
result(1).convg = convg;
end;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品婷婷伊人一区三区三| 久久精品夜夜夜夜久久| 懂色av中文字幕一区二区三区| 一区二区三区日韩在线观看| 国产精品电影一区二区| 国产精品理论在线观看| 中文字幕五月欧美| 亚洲欧洲精品一区二区精品久久久 | 亚洲一区二区不卡免费| 久久精品一区二区| 亚洲乱码国产乱码精品精的特点 | 欧美卡1卡2卡| 欧美一区二区在线观看| 日韩美女一区二区三区| 精品国内二区三区| 国产婷婷一区二区| |精品福利一区二区三区| 亚洲免费观看高清完整| 日韩中文字幕av电影| 久久99精品一区二区三区| 国产精品中文字幕一区二区三区| 国产suv一区二区三区88区| 成人成人成人在线视频| 欧美色精品天天在线观看视频| 欧美日韩国产123区| 久久综合九色综合久久久精品综合| 国产亚洲精品精华液| 一区二区三区不卡在线观看| 蜜臀a∨国产成人精品| 成人性视频网站| 欧美日韩在线三区| 久久精品一二三| 亚洲综合色在线| 国产乱人伦偷精品视频不卡| 91福利在线看| 久久婷婷综合激情| 亚洲综合视频在线| 成人免费不卡视频| 91精品国产欧美日韩| 国产精品国产精品国产专区不片| 午夜久久久久久| 不卡一区二区中文字幕| 日韩一卡二卡三卡| 亚洲日本护士毛茸茸| 国产在线视频精品一区| 在线看日韩精品电影| 国产婷婷色一区二区三区在线| 亚洲国产一区二区三区| 国产激情视频一区二区在线观看| 欧美日韩国产大片| 一区二区三区高清| a4yy欧美一区二区三区| 久久综合九色综合欧美亚洲| 肉色丝袜一区二区| 色婷婷久久久久swag精品| 久久免费的精品国产v∧| 亚洲成人你懂的| 色综合久久88色综合天天免费| 欧美高清一级片在线观看| 蜜桃视频在线一区| 91精品欧美综合在线观看最新| 国产精品国产三级国产| 成人一区二区三区视频在线观看| 精品国产自在久精品国产| 日本vs亚洲vs韩国一区三区| 欧美日韩一区二区三区免费看| 亚洲老司机在线| 91丨九色porny丨蝌蚪| 国产精品黄色在线观看| 丰满少妇久久久久久久| 日本一区二区电影| 国产**成人网毛片九色| 国产精品区一区二区三区| 国产电影一区二区三区| 国产蜜臀97一区二区三区 | 久久久精品2019中文字幕之3| 日本伊人色综合网| 日韩亚洲欧美在线| 久久国产麻豆精品| 欧美xxx久久| 激情文学综合丁香| 国产无一区二区| 成人激情小说网站| ●精品国产综合乱码久久久久| 风间由美一区二区三区在线观看| 国产精品天天看| 色婷婷亚洲精品| 日本中文字幕一区二区视频| 精品久久久网站| 夫妻av一区二区| 亚洲综合一二三区| 91精品国产综合久久久久久 | 亚洲精品在线观看网站| 国产精品一卡二卡在线观看| 中文字幕不卡在线播放| 色婷婷综合五月| 日韩主播视频在线| 国产性做久久久久久| 色婷婷一区二区| 青草av.久久免费一区| 国产午夜亚洲精品理论片色戒| av一二三不卡影片| 丝袜脚交一区二区| 日本一区二区电影| 欧美日韩一二区| 国产精品一二三区在线| 一区二区三区日韩在线观看| 日韩精品一区二区三区在线| 成人av电影观看| 亚洲国产你懂的| 久久女同互慰一区二区三区| 色呦呦国产精品| 韩国av一区二区三区四区| 亚洲三级在线播放| 久久一夜天堂av一区二区三区| 91麻豆文化传媒在线观看| 免费久久精品视频| 一区二区三区免费在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 91麻豆高清视频| 国产精品69久久久久水密桃| 亚洲国产精品欧美一二99| 亚洲天堂久久久久久久| 91精品国产欧美一区二区18| 成人黄色a**站在线观看| 看国产成人h片视频| 一区二区日韩电影| 欧美高清在线一区二区| 精品国产人成亚洲区| 欧美三区在线观看| 91啪在线观看| 成人中文字幕在线| 久久aⅴ国产欧美74aaa| 亚洲成人www| 一个色综合网站| 中文字幕一区二区三中文字幕| ww亚洲ww在线观看国产| 欧美一区日韩一区| 欧美巨大另类极品videosbest | 91在线你懂得| 国产99久久久久| 狠狠网亚洲精品| 老司机午夜精品| 亚洲bt欧美bt精品777| 一区二区三区高清不卡| 亚洲永久免费av| 亚洲一区二区三区精品在线| 亚洲欧美国产77777| 亚洲欧洲成人自拍| 亚洲视频 欧洲视频| 国产欧美日韩综合| 中文字幕不卡在线播放| 国产精品久久国产精麻豆99网站| 国产欧美一区二区三区鸳鸯浴| www久久精品| 中文字幕不卡的av| 综合激情成人伊人| 亚洲在线一区二区三区| 亚洲电影中文字幕在线观看| 午夜精品福利一区二区三区av| 亚洲成av人片在线| 奇米精品一区二区三区在线观看 | 欧美浪妇xxxx高跟鞋交| 欧美精品99久久久**| 欧美一区二区高清| 26uuu精品一区二区 | 色先锋资源久久综合| 色成年激情久久综合| 在线观看日韩精品| 欧美一区二区日韩一区二区| 精品成人一区二区| 中文字幕免费不卡| 亚洲图片自拍偷拍| 老司机精品视频线观看86| 国产一区二区三区香蕉 | 亚洲精品成人少妇| 欧美一区二区免费| 亚洲自拍与偷拍| 制服丝袜中文字幕亚洲| 欧美性生活久久| 欧美一区二区三区白人| 国产亚洲一本大道中文在线| 中文字幕一区二区三区在线播放| 一级日本不卡的影视| 精品综合久久久久久8888| a级精品国产片在线观看| 欧美日韩精品福利| 国产欧美一区二区精品婷婷| 亚洲一区二区影院| 国产毛片精品一区| 欧美区在线观看| 国产精品美女一区二区| 日本一区中文字幕| 9i在线看片成人免费| 欧美成人在线直播| 亚洲综合成人在线| av欧美精品.com| 亚洲精品一线二线三线| 一区二区三区中文字幕在线观看| 美女脱光内衣内裤视频久久影院|