Home > matlab > dsgevar_posterior_density.m

dsgevar_posterior_density

PURPOSE ^

This function characterizes the posterior distribution of a bvar with

SYNOPSIS ^

function bvar = dsgevar_posterior_density(deep,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults)

DESCRIPTION ^

 This function characterizes the posterior distribution of a bvar with
 a dsge prior (as in Del Negro and Schorfheide 2003) for a given value
 of the deep parameters (structural parameters + the size of the
 shocks + dsge_prior_weight).

 INPUTS
   deep:      [double] a vector with the deep parameters.

 OUTPUTS
   bvar:      a matlab structure with prior and posterior densities.

 ALGORITHM
   ...
 SPECIAL REQUIREMENTS
   none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bvar = dsgevar_posterior_density(deep,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults)
0002 % This function characterizes the posterior distribution of a bvar with
0003 % a dsge prior (as in Del Negro and Schorfheide 2003) for a given value
0004 % of the deep parameters (structural parameters + the size of the
0005 % shocks + dsge_prior_weight).
0006 %
0007 % INPUTS
0008 %   deep:      [double] a vector with the deep parameters.
0009 %
0010 % OUTPUTS
0011 %   bvar:      a matlab structure with prior and posterior densities.
0012 %
0013 % ALGORITHM
0014 %   ...
0015 % SPECIAL REQUIREMENTS
0016 %   none
0017 %
0018 
0019 % Copyright (C) 1996-2008 Dynare Team
0020 %
0021 % This file is part of Dynare.
0022 %
0023 % Dynare is free software: you can redistribute it and/or modify
0024 % it under the terms of the GNU General Public License as published by
0025 % the Free Software Foundation, either version 3 of the License, or
0026 % (at your option) any later version.
0027 %
0028 % Dynare is distributed in the hope that it will be useful,
0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0031 % GNU General Public License for more details.
0032 %
0033 % You should have received a copy of the GNU General Public License
0034 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0035 
0036 gend = options_.nobs;
0037 dsge_prior_weight = M_.params(strmatch('dsge_prior_weight',M_.param_names));
0038 DSGE_PRIOR_WEIGHT = floor(gend*(1+dsge_prior_weight));
0039 
0040 bvar.NumberOfLags = options_.varlag;
0041 bvar.NumberOfVariables = size(options_.varobs,1);
0042 bvar.Constant = 'no';
0043 bvar.NumberOfEstimatedParameters = bvar.NumberOfLags*bvar.NumberOfVariables;
0044 if ~options_.noconstant
0045     bvar.Constant = 'yes';
0046     bvar.NumberOfEstimatedParameters = bvar.NumberOfEstimatedParameters + ...
0047         bvar.NumberOfVariables;
0048 end
0049 
0050 [fval,cost_flag,info,PHI,SIGMAu,iXX,prior] =  DsgeVarLikelihood(deep',DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
0051 
0052 % Conditionnal posterior density of the lagged matrices (given Sigma) ->
0053 % Matric-variate normal distribution.
0054 bvar.LaggedMatricesConditionalOnSigma.posterior.density = 'matric-variate normal';
0055 bvar.LaggedMatricesConditionalOnSigma.posterior.arg1 = PHI;
0056 bvar.LaggedMatricesConditionalOnSigma.posterior.arg2 = 'Sigma';
0057 bvar.LaggedMatricesConditionalOnSigma.posterior.arg3 = iXX;
0058 
0059 % Marginal posterior density of the covariance matrix -> Inverted Wishart.
0060 bvar.Sigma.posterior.density = 'inverse wishart';
0061 bvar.Sigma.posterior.arg1 = SIGMAu*DSGE_PRIOR_WEIGHT;
0062 bvar.Sigma.posterior.arg2 = DSGE_PRIOR_WEIGHT-bvar.NumberOfEstimatedParameters;
0063 
0064 % Marginal posterior density of the lagged matrices -> Generalized
0065 % Student distribution (See appendix B.5 in Zellner (1971)).
0066 bvar.LaggedMatrices.posterior.density = 'matric-variate student';
0067 bvar.LaggedMatrices.posterior.arg1 = inv(iXX);%P
0068 bvar.LaggedMatrices.posterior.arg2 = SIGMAu*DSGE_PRIOR_WEIGHT;%Q
0069 bvar.LaggedMatrices.posterior.arg3 = PHI;%M (posterior mean)
0070 bvar.LaggedMatrices.posterior.arg4 = DSGE_PRIOR_WEIGHT;%(sample size)
0071 
0072 
0073 
0074 % Conditionnal posterior density of the lagged matrices (given Sigma) ->
0075 % Matric-variate normal distribution.
0076 bvar.LaggedMatricesConditionalOnSigma.prior.density = 'matric-variate normal';
0077 bvar.LaggedMatricesConditionalOnSigma.prior.arg1 = prior.PHIstar;
0078 bvar.LaggedMatricesConditionalOnSigma.prior.arg2 = 'Sigma';
0079 bvar.LaggedMatricesConditionalOnSigma.prior.arg3 = prior.iGXX;
0080 
0081 % Marginal posterior density of the covariance matrix -> Inverted Wishart.
0082 bvar.Sigma.prior.density = 'inverse wishart';
0083 bvar.Sigma.prior.arg1 = prior.SIGMAstar*prior.ArtificialSampleSize;
0084 bvar.Sigma.prior.arg2 = prior.DF;
0085 
0086 % Marginal posterior density of the lagged matrices -> Generalized
0087 % Student distribution (See appendix B.5 in Zellner (1971)).
0088 bvar.LaggedMatrices.prior.density = 'matric-variate student';
0089 bvar.LaggedMatrices.prior.arg1 = inv(prior.iGXX);%P
0090 bvar.LaggedMatrices.prior.arg2 = prior.SIGMAstar*prior.ArtificialSampleSize;%Q
0091 bvar.LaggedMatrices.prior.arg3 = prior.PHIstar;%M (posterior mean)
0092 bvar.LaggedMatrices.prior.arg4 = prior.ArtificialSampleSize;%(sample size)

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005