messv_g3d.m

来自「计量工具箱」· M 代码 · 共 45 行

M
45
字号
% PURPOSE: An example of using messv_g3() on a small dataset% Gibbs sampling the matrix exponential heteroscedastic spatial model% using Anselin's Columbus crime data% this function samples over both rho and #neighbors% to produce a joint posterior for all parameters in the model%                              %---------------------------------------------------% USAGE: messv_g3d%---------------------------------------------------clear all;% load Anselin (1988) Columbus neighborhood crime dataload anselin.dat;y = anselin(:,1);  n = length(y);x = [ones(n,1) anselin(:,2:3)];xc = anselin(:,4); % x-coordinatesyc = anselin(:,5); % y-coordinatesvnames = strvcat('crime','constant','income','hvalue');  % do Bayesian MCMC estimatendraw = 1250;nomit = 250;option.latt = xc;option.long = yc;option.mmin = 1;option.mmax = 10;option.rmin = .1;option.rmax = 1;prior.rval = 4; % note this is the default                % if you enter nothing by way of a priorres1 = messv_g3(y,x,option,ndraw,nomit,prior);prt(res1,vnames);% plot the vi estimatestt=1:n;plot(tt,res1.vmean);title('posterior mean of vi estimates');

⌨️ 快捷键说明

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