📄 messv_g3d.m
字号:
% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -