121 lines
7.9 KiB
HTML
121 lines
7.9 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Description of varprior</title>
|
||
|
<meta name="keywords" content="varprior">
|
||
|
<meta name="description" content="function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior)">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||
|
<meta name="generator" content="m2html © 2003 Guillaume Flandin">
|
||
|
<meta name="robots" content="index, follow">
|
||
|
<link type="text/css" rel="stylesheet" href="../m2html.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<a name="_top"></a>
|
||
|
<div><a href="../index.html">Home</a> > <a href="index.html">.</a> > varprior.m</div>
|
||
|
|
||
|
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td>
|
||
|
<td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
|
||
|
|
||
|
<h1>varprior
|
||
|
</h1>
|
||
|
|
||
|
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="box"><strong>function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior)</strong></div>
|
||
|
|
||
|
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="box"><strong>function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior) </strong></div>
|
||
|
|
||
|
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="fragment"><pre class="comment">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.
|
||
|
-----------------------</pre></div>
|
||
|
|
||
|
<!-- crossreference -->
|
||
|
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
This function calls:
|
||
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
||
|
</ul>
|
||
|
This function is called by:
|
||
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
||
|
<li><a href="mgnldnsty.html" class="code" title="function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)">mgnldnsty</a> function w=mgnldnsty(ydata,lags,xdata,breaks,lambda,mu,mnprior,vprior,train,flat)</li></ul>
|
||
|
<!-- crossreference -->
|
||
|
|
||
|
|
||
|
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior)</a>
|
||
|
0002 <span class="comment">%function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior)</span>
|
||
|
0003 <span class="comment">% ydum, xdum: dummy observation data that implement the prior</span>
|
||
|
0004 <span class="comment">% breaks: vector of points in the dummy data after which new dummy obs's start</span>
|
||
|
0005 <span class="comment">% Set breaks=T+[0;breaks], ydata=[ydata;ydum], xdum=[xdata;xdum], where</span>
|
||
|
0006 <span class="comment">% actual data matrix has T rows, in preparing input for rfvar3</span>
|
||
|
0007 <span class="comment">% nv,nx,lags: VAR dimensions</span>
|
||
|
0008 <span class="comment">% mnprior.tight:Overall tightness of Minnesota prior</span>
|
||
|
0009 <span class="comment">% mnprior.decay:Standard deviations of lags shrink as lag^(-decay)</span>
|
||
|
0010 <span class="comment">% vprior.sig: Vector of prior modes for diagonal elements of r.f. covariance matrix</span>
|
||
|
0011 <span class="comment">% vprior.w: Weight on prior on vcv. 1 corresponds to "one dummy observation" weight</span>
|
||
|
0012 <span class="comment">% Should be an integer, and will be rounded if not. vprior.sig is needed</span>
|
||
|
0013 <span class="comment">% to scale the Minnesota prior, even if the prior on sigma is not used itself.</span>
|
||
|
0014 <span class="comment">% Set vprior.w=0 to achieve this.</span>
|
||
|
0015 <span class="comment">% Note: The original Minnesota prior treats own lags asymmetrically, and therefore</span>
|
||
|
0016 <span class="comment">% cannot be implemented entirely with dummy observations. It is also usually</span>
|
||
|
0017 <span class="comment">% taken to include the sum-of-coefficients and co-persistence components</span>
|
||
|
0018 <span class="comment">% that are implemented directly in rfvar3.m. The diagonal prior on v, combined</span>
|
||
|
0019 <span class="comment">% with sum-of-coefficients and co-persistence components and with the unit own-first-lag</span>
|
||
|
0020 <span class="comment">% prior mean generates larger prior variances for own than for cross-effects even in</span>
|
||
|
0021 <span class="comment">% this formulation, but here there is no way to shrink toward a set of unconstrained</span>
|
||
|
0022 <span class="comment">% univariate AR's.</span>
|
||
|
0023 <span class="comment">%-----------------------</span>
|
||
|
0024 <span class="comment">%</span>
|
||
|
0025 <span class="keyword">if</span> ~isempty(mnprior)
|
||
|
0026 xdum=zeros(lags+1,nx,lags,nv);
|
||
|
0027 ydum=zeros(lags+1,nv,lags,nv);
|
||
|
0028 <span class="keyword">for</span> il=1:lags
|
||
|
0029 ydum(il+1,:,il,:)=il^mnprior.decay*diag(vprior.sig);
|
||
|
0030 <span class="keyword">end</span>
|
||
|
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 <span class="keyword">else</span>
|
||
|
0039 ydum=[];
|
||
|
0040 xdum=[];
|
||
|
0041 breaks=[];
|
||
|
0042 lbreak=0;
|
||
|
0043 <span class="keyword">end</span>
|
||
|
0044 <span class="keyword">if</span> ~isempty(vprior) & vprior.w>0
|
||
|
0045 ydum2=zeros(lags+1,nv,nv);
|
||
|
0046 xdum2=zeros(lags+1,nx,nv);
|
||
|
0047 ydum2(<span class="keyword">end</span>,:,:)=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 <span class="keyword">end</span></pre></div>
|
||
|
<hr><address>Generated on Fri 16-Jun-2006 09:09:06 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address>
|
||
|
</body>
|
||
|
</html>
|