lad_d.m

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

M
34
字号
% PURPOSE: An example using lad(),
%                           prt_reg(),
%                           plt_reg(),
% least-absolute deviations estimation
%---------------------------------------------------
% USAGE: lad_d
%---------------------------------------------------

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

randn('state',0);

xmat = randn(nobs,nvar-1);

x = [ones(nobs,1) xmat];
evec = randn(nobs,1).^4; % create leptokurtic errors

y = x*beta + evec;


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

% do lad regression
lresult = lad(y,x);
% print the output
prt_reg(lresult);


⌨️ 快捷键说明

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