⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f_far.m

📁 计量工具箱
💻 M
字号:
function llike = f_far(rho,y,W,detval)
% PURPOSE: evaluate the concentrated log-likelihood 
%  1st order spatial autoregressive model using sparse matrix algorithms
% ---------------------------------------------------
%  USAGE:llike = f_far(rho,y,W)
%  where: rho  = spatial autoregressive parameter
%         y    = dependent variable vector
%         W    = spatial weight matrix
%         ldet = matrix with [rho log determinant] values
%                computed in far.m using one of 
%                Pace and Barry's routines         
% ---------------------------------------------------
%  RETURNS: a  scalar equal to minus the log-likelihood
%           function value at the parameter rho
%  --------------------------------------------------
%  SEE ALSO: f_far2, far, f_sar, f_sac, f_sem
% ---------------------------------------------------

% written by: James P. LeSage 4/2002
% University of Toledo
% Department of Economics
% Toledo, OH 43606
% jlesage@spatial-econometrics.com


gsize = detval(2,1) - detval(1,1);

i1 = find(detval(:,1) <= rho + gsize);
i2 = find(detval(:,1) <= rho - gsize);
i1 = max(i1);
i2 = max(i2);
index = round((i1+i2)/2);
if isempty(index)
index = 1;
end;
detm = detval(index,2);
n = length(y);
e = (speye(n) - rho*sparse(W))*y;;
epe = e'*e;
llike = (n/2)*log(epe) - detm;

⌨️ 快捷键说明

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