olst_d.m

来自「时间序列分析中常用到的matlab代码」· M 代码 · 共 34 行

M
34
字号
% PURPOSE: An example using olst(),
%                           prt_reg(),
%                           plt_reg(),
% ols with t-distributed errors estimation
%---------------------------------------------------
% USAGE: olst_d
%---------------------------------------------------

nobs = 100;
nvar = 5;
beta = ones(nvar,1);

randn('state',0);

xmat = randn(nobs,nvar-1);

x = [ones(nobs,1) xmat];
evec = tdis_rnd(nobs,2)*0.5; % generate t-distributed errors

y = x*beta + evec;


% do ols regression
result = ols(y,x); 
% print the output
prt_reg(result);

% do robust t-distributed errors regression
lresult = olst(y,x,1000,1e-4);
% print the output
prt_reg(lresult);


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?