function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior) ydum, xdum: dummy observation data that implement the prior breaks: vector of points in the dummy data after which new dummy obs's start Set breaks=T+[0;breaks], ydata=[ydata;ydum], xdum=[xdata;xdum], where actual data matrix has T rows, in preparing input for rfvar3 nv,nx,lags: VAR dimensions mnprior.tight:Overall tightness of Minnesota prior mnprior.decay:Standard deviations of lags shrink as lag^(-decay) vprior.sig: Vector of prior modes for diagonal elements of r.f. covariance matrix vprior.w: Weight on prior on vcv. 1 corresponds to "one dummy observation" weight Should be an integer, and will be rounded if not. vprior.sig is needed to scale the Minnesota prior, even if the prior on sigma is not used itself. Set vprior.w=0 to achieve this. Note: The original Minnesota prior treats own lags asymmetrically, and therefore cannot be implemented entirely with dummy observations. It is also usually taken to include the sum-of-coefficients and co-persistence components that are implemented directly in rfvar3.m. The diagonal prior on v, combined with sum-of-coefficients and co-persistence components and with the unit own-first-lag prior mean generates larger prior variances for own than for cross-effects even in this formulation, but here there is no way to shrink toward a set of unconstrained univariate AR's. -----------------------
0001 function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior) 0002 %function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior) 0003 % ydum, xdum: dummy observation data that implement the prior 0004 % breaks: vector of points in the dummy data after which new dummy obs's start 0005 % Set breaks=T+[0;breaks], ydata=[ydata;ydum], xdum=[xdata;xdum], where 0006 % actual data matrix has T rows, in preparing input for rfvar3 0007 % nv,nx,lags: VAR dimensions 0008 % mnprior.tight:Overall tightness of Minnesota prior 0009 % mnprior.decay:Standard deviations of lags shrink as lag^(-decay) 0010 % vprior.sig: Vector of prior modes for diagonal elements of r.f. covariance matrix 0011 % vprior.w: Weight on prior on vcv. 1 corresponds to "one dummy observation" weight 0012 % Should be an integer, and will be rounded if not. vprior.sig is needed 0013 % to scale the Minnesota prior, even if the prior on sigma is not used itself. 0014 % Set vprior.w=0 to achieve this. 0015 % Note: The original Minnesota prior treats own lags asymmetrically, and therefore 0016 % cannot be implemented entirely with dummy observations. It is also usually 0017 % taken to include the sum-of-coefficients and co-persistence components 0018 % that are implemented directly in rfvar3.m. The diagonal prior on v, combined 0019 % with sum-of-coefficients and co-persistence components and with the unit own-first-lag 0020 % prior mean generates larger prior variances for own than for cross-effects even in 0021 % this formulation, but here there is no way to shrink toward a set of unconstrained 0022 % univariate AR's. 0023 %----------------------- 0024 % 0025 if ~isempty(mnprior) 0026 xdum=zeros(lags+1,nx,lags,nv); 0027 ydum=zeros(lags+1,nv,lags,nv); 0028 for il=1:lags 0029 ydum(il+1,:,il,:)=il^mnprior.decay*diag(vprior.sig); 0030 end 0031 ydum(1,:,1,:)=diag(vprior.sig); 0032 ydum=mnprior.tight*reshape(ydum,[lags+1,nv,lags*nv]); 0033 ydum=flipdim(ydum,1); 0034 xdum=mnprior.tight*reshape(xdum,[lags+1,nx,lags*nv]); 0035 xdum=flipdim(xdum,1); 0036 breaks=(lags+1)*[1:(nv*lags)]'; 0037 lbreak=breaks(end); 0038 else 0039 ydum=[]; 0040 xdum=[]; 0041 breaks=[]; 0042 lbreak=0; 0043 end 0044 if ~isempty(vprior) & vprior.w>0 0045 ydum2=zeros(lags+1,nv,nv); 0046 xdum2=zeros(lags+1,nx,nv); 0047 ydum2(end,:,:)=diag(vprior.sig); 0048 ydum=cat(3,ydum,ydum2); 0049 xdum=cat(3,xdum,xdum2); 0050 dimy=size(ydum); 0051 ydum=reshape(permute(ydum,[1 3 2]),dimy(1)*dimy(3),nv); 0052 xdum=reshape(permute(xdum,[1 3 2]),dimy(1)*dimy(3),nx); 0053 breaks=[breaks;(lags+1)*[1:nv-1]'+lbreak]; 0054 end