190 lines
11 KiB
HTML
190 lines
11 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 set_prior</title>
|
||
|
<meta name="keywords" content="set_prior">
|
||
|
<meta name="description" content="">
|
||
|
<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> > set_prior.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>set_prior
|
||
|
</h1>
|
||
|
|
||
|
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="box"><strong></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 [xparam1,estim_params_,bayestopt_,lb,ub]=set_prior(estim_params_) </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"></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)">
|
||
|
<li><a href="inverse_gamma_specification.html" class="code" title="function [s,nu] = inverse_gamma_specification(mu,sigma,type)">inverse_gamma_specification</a> </li><li><a href="uniform_specification.html" class="code" title="function [m,s,p1,p2] = uniform_specification(m,s,p3,p4)">uniform_specification</a> Copyright (C) 2004 Michel Juillard</li></ul>
|
||
|
This function is called by:
|
||
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
||
|
<li><a href="dynare_MC.html" class="code" title="function dynare_MC(var_list_)">dynare_MC</a> </li><li><a href="dynare_estimation.html" class="code" title="function dynare_estimation(var_list_)">dynare_estimation</a> </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 [xparam1,estim_params_,bayestopt_,lb,ub]=set_prior(estim_params_)</a>
|
||
|
0002 <span class="keyword">global</span> M_ options_
|
||
|
0003
|
||
|
0004 nvx = size(estim_params_.var_exo,1);
|
||
|
0005 nvn = size(estim_params_.var_endo,1);
|
||
|
0006 ncx = size(estim_params_.corrx,1);
|
||
|
0007 ncn = size(estim_params_.corrn,1);
|
||
|
0008 np = size(estim_params_.param_vals,1);
|
||
|
0009
|
||
|
0010 estim_params_.nvx = nvx;
|
||
|
0011 estim_params_.nvn = nvn;
|
||
|
0012 estim_params_.ncx = ncx;
|
||
|
0013 estim_params_.ncn = ncn;
|
||
|
0014 estim_params_.np = np;
|
||
|
0015
|
||
|
0016 xparam1 = [];
|
||
|
0017 ub = [];
|
||
|
0018 lb = [];
|
||
|
0019 bayestopt_.pshape = [];
|
||
|
0020 bayestopt_.pmean = [];
|
||
|
0021 bayestopt_.pstdev = [];
|
||
|
0022 bayestopt_.p1 = [];
|
||
|
0023 bayestopt_.p2 = [];
|
||
|
0024 bayestopt_.p3 = [];
|
||
|
0025 bayestopt_.p4 = [];
|
||
|
0026 bayestopt_.jscale = [];
|
||
|
0027 bayestopt_.name = [];
|
||
|
0028 <span class="keyword">if</span> nvx
|
||
|
0029 xparam1 = estim_params_.var_exo(:,2);
|
||
|
0030 ub = estim_params_.var_exo(:,4);
|
||
|
0031 lb = estim_params_.var_exo(:,3);
|
||
|
0032 bayestopt_.pshape = estim_params_.var_exo(:,5);
|
||
|
0033 bayestopt_.pmean = estim_params_.var_exo(:,6);
|
||
|
0034 bayestopt_.pstdev = estim_params_.var_exo(:,7);
|
||
|
0035 bayestopt_.p3 = estim_params_.var_exo(:,8);
|
||
|
0036 bayestopt_.p4 = estim_params_.var_exo(:,9);
|
||
|
0037 bayestopt_.jscale = estim_params_.var_exo(:,10);
|
||
|
0038 bayestopt_.name = cellstr(M_.exo_names(estim_params_.var_exo(:,1),:));
|
||
|
0039 <span class="keyword">end</span>
|
||
|
0040 <span class="keyword">if</span> nvn
|
||
|
0041 <span class="keyword">for</span> i=1:nvn
|
||
|
0042 estim_params_.var_endo(i,1) = strmatch(deblank(M_.endo_names(estim_params_.var_endo(i,1),:)),deblank(options_.varobs),<span class="string">'exact'</span>);
|
||
|
0043 <span class="keyword">end</span>
|
||
|
0044 xparam1 = [xparam1; estim_params_.var_endo(:,2)];
|
||
|
0045 ub = [ub; estim_params_.var_endo(:,4)];
|
||
|
0046 lb = [lb; estim_params_.var_endo(:,3)];
|
||
|
0047 bayestopt_.pshape = [ bayestopt_.pshape; estim_params_.var_endo(:,5)];
|
||
|
0048 bayestopt_.pmean = [ bayestopt_.pmean; estim_params_.var_endo(:,6)];
|
||
|
0049 bayestopt_.pstdev = [ bayestopt_.pstdev; estim_params_.var_endo(:,7)];
|
||
|
0050 bayestopt_.p3 = [ bayestopt_.p3; estim_params_.var_endo(:,8)];
|
||
|
0051 bayestopt_.p4 = [ bayestopt_.p4; estim_params_.var_endo(:,9)];
|
||
|
0052 bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.var_endo(:,10)];
|
||
|
0053 bayestopt_.name = cellstr(strvcat(char(bayestopt_.name),<span class="keyword">...</span>
|
||
|
0054 M_.endo_names(estim_params_.var_endo(:,1),:)));
|
||
|
0055 <span class="keyword">end</span>
|
||
|
0056 <span class="keyword">if</span> ncx
|
||
|
0057 xparam1 = [xparam1; estim_params_.corrx(:,3)];
|
||
|
0058 ub = [ub; max(min(estim_params_.corrx(:,5),1),-1)];
|
||
|
0059 lb = [lb; max(min(estim_params_.corrx(:,4),1),-1)];
|
||
|
0060 bayestopt_.pshape = [ bayestopt_.pshape; estim_params_.corrx(:,6)];
|
||
|
0061 bayestopt_.pmean = [ bayestopt_.pmean; estim_params_.corrx(:,7)];
|
||
|
0062 bayestopt_.pstdev = [ bayestopt_.pstdev; estim_params_.corrx(:,8)];
|
||
|
0063 bayestopt_.p3 = [ bayestopt_.p3; estim_params_.corrx(:,9)];
|
||
|
0064 bayestopt_.p4 = [ bayestopt_.p4; estim_params_.corrx(:,10)];
|
||
|
0065 bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.corrx(:,11)];
|
||
|
0066 bayestopt_.name = cellstr(strvcat(char(bayestopt_.name),<span class="keyword">...</span>
|
||
|
0067 char(strcat(cellstr(M_.exo_names(estim_params_.corrx(:,1),:)),<span class="keyword">...</span>
|
||
|
0068 <span class="string">','</span>,<span class="keyword">...</span>
|
||
|
0069 cellstr(M_.exo_names(estim_params_.corrx(:,2),:))))));
|
||
|
0070 <span class="keyword">end</span>
|
||
|
0071 <span class="keyword">if</span> ncn
|
||
|
0072 xparam1 = [xparam1; estim_params_.corrn(:,3)];
|
||
|
0073 ub = [ub; max(min(estim_params_.corrn(:,5),1),-1)];
|
||
|
0074 lb = [lb; max(min(estim_params_.corrn(:,4),1),-1)];
|
||
|
0075 bayestopt_.pshape = [ bayestopt_.pshape; estim_params_.corrn(:,6)];
|
||
|
0076 bayestopt_.pmean = [ bayestopt_.pmean; estim_params_.corrn(:,7)];
|
||
|
0077 bayestopt_.pstdev = [ bayestopt_.pstdev; estim_params_.corrn(:,8)];
|
||
|
0078 bayestopt_.p3 = [ bayestopt_.p3; estim_params_.corrn(:,9)];
|
||
|
0079 bayestopt_.p4 = [ bayestopt_.p4; estim_params_.corrn(:,10)];
|
||
|
0080 bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.corrn(:,11)];
|
||
|
0081 bayestopt_.name = cellstr(strvcat(char(bayestopt_.name),<span class="keyword">...</span>
|
||
|
0082 char(strcat(cellstr(M_.endo_names(estim_params_.corrn(:,1),:)),<span class="keyword">...</span>
|
||
|
0083 <span class="string">','</span>,<span class="keyword">...</span>
|
||
|
0084 cellstr(M_.endo_names(estim_params_.corrn(:,2),:))))));
|
||
|
0085 <span class="keyword">end</span>
|
||
|
0086 <span class="keyword">if</span> np
|
||
|
0087 xparam1 = [xparam1; estim_params_.param_vals(:,2)];
|
||
|
0088 ub = [ub; estim_params_.param_vals(:,4)];
|
||
|
0089 lb = [lb; estim_params_.param_vals(:,3)];
|
||
|
0090 bayestopt_.pshape = [ bayestopt_.pshape; estim_params_.param_vals(:,5)];
|
||
|
0091 bayestopt_.pmean = [ bayestopt_.pmean; estim_params_.param_vals(:,6)];
|
||
|
0092 bayestopt_.pstdev = [ bayestopt_.pstdev; estim_params_.param_vals(:,7)];
|
||
|
0093 bayestopt_.p3 = [ bayestopt_.p3; estim_params_.param_vals(:,8)];
|
||
|
0094 bayestopt_.p4 = [ bayestopt_.p4; estim_params_.param_vals(:,9)];
|
||
|
0095 bayestopt_.jscale = [ bayestopt_.jscale; estim_params_.param_vals(:, <span class="keyword">...</span>
|
||
|
0096 10)];
|
||
|
0097 bayestopt_.name = cellstr(strvcat(char(bayestopt_.name),M_.param_names(estim_params_.param_vals(:,1),:)));
|
||
|
0098 <span class="keyword">end</span>
|
||
|
0099
|
||
|
0100 bayestopt_.ub = ub;
|
||
|
0101 bayestopt_.lb = lb;
|
||
|
0102
|
||
|
0103 bayestopt_.p1 = bayestopt_.pmean;
|
||
|
0104 bayestopt_.p2 = bayestopt_.pstdev;
|
||
|
0105
|
||
|
0106 <span class="comment">% generalized location parameters by default for beta distribution</span>
|
||
|
0107 k = find(bayestopt_.pshape == 1);
|
||
|
0108 k1 = find(isnan(bayestopt_.p3(k)));
|
||
|
0109 bayestopt_.p3(k(k1)) = zeros(length(k1),1);
|
||
|
0110 k1 = find(isnan(bayestopt_.p4(k)));
|
||
|
0111 bayestopt_.p4(k(k1)) = ones(length(k1),1);
|
||
|
0112
|
||
|
0113 <span class="comment">% generalized location parameter by default for gamma distribution</span>
|
||
|
0114 k = find(bayestopt_.pshape == 2);
|
||
|
0115 k1 = find(isnan(bayestopt_.p3(k)));
|
||
|
0116 bayestopt_.p3(k(k1)) = zeros(length(k1),1);
|
||
|
0117
|
||
|
0118 <span class="comment">% truncation parameters by default for normal distribution</span>
|
||
|
0119 k = find(bayestopt_.pshape == 3);
|
||
|
0120 k1 = find(isnan(bayestopt_.p3(k)));
|
||
|
0121 bayestopt_.p3(k(k1)) = -Inf*ones(length(k1),1);
|
||
|
0122 k1 = find(isnan(bayestopt_.p4(k)));
|
||
|
0123 bayestopt_.p4(k(k1)) = Inf*ones(length(k1),1);
|
||
|
0124
|
||
|
0125 k = find(bayestopt_.pshape == 4);
|
||
|
0126 <span class="keyword">for</span> i=1:length(k)
|
||
|
0127 [bayestopt_.p1(k(i)),bayestopt_.p2(k(i))] = <span class="keyword">...</span>
|
||
|
0128 <a href="inverse_gamma_specification.html" class="code" title="function [s,nu] = inverse_gamma_specification(mu,sigma,type)">inverse_gamma_specification</a>(bayestopt_.pmean(k(i)),bayestopt_.pstdev(k(i)),1);
|
||
|
0129 <span class="keyword">end</span>
|
||
|
0130
|
||
|
0131 k = find(bayestopt_.pshape == 5);
|
||
|
0132 <span class="keyword">for</span> i=1:length(k)
|
||
|
0133 [bayestopt_.pmean(k(i)),bayestopt_.pstdev(k(i)),bayestopt_.p1(k(i)),bayestopt_.p2(k(i))] = <span class="keyword">...</span>
|
||
|
0134 <a href="uniform_specification.html" class="code" title="function [m,s,p1,p2] = uniform_specification(m,s,p3,p4)">uniform_specification</a>(bayestopt_.pmean(k(i)),bayestopt_.pstdev(k(i)),bayestopt_.p3(k(i)),bayestopt_.p4(k(i)));
|
||
|
0135 <span class="keyword">end</span>
|
||
|
0136
|
||
|
0137 k = find(bayestopt_.pshape == 6);
|
||
|
0138 <span class="keyword">for</span> i=1:length(k)
|
||
|
0139 [bayestopt_.p1(k(i)),bayestopt_.p2(k(i))] = <span class="keyword">...</span>
|
||
|
0140 <a href="inverse_gamma_specification.html" class="code" title="function [s,nu] = inverse_gamma_specification(mu,sigma,type)">inverse_gamma_specification</a>(bayestopt_.pmean(k(i)),bayestopt_.pstdev(k(i)),2);
|
||
|
0141 <span class="keyword">end</span>
|
||
|
0142
|
||
|
0143 k = find(isnan(xparam1));
|
||
|
0144 xparam1(k) = bayestopt_.pmean(k);</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>
|