Page 1 of 1

how to incorporate asymmetrical priors

PostPosted: Mon Sep 06, 2010 4:46 am
by jefflovejapan
I'd like to reproduce the results in a paper I'm currently reading. The problem is that the prior data only includes the distribution, mean and confidence interval used, and not the standard deviation. I know that Dynare only takes mean and stddev as input arguments when declaring priors, which begs the question, how do you incorporate asymmetrical priors? It was my understanding that one of the benefits of using the MCMC technique is the ability to use asymmetrical priors, plus it seems like several commonly-used prior distributions (beta, gamma, etc.) are asymmetrical. There must be something I'm misunderstanding about the way prior distributions are entered.

I'm sure this is a simple question, but I can't find any information in the manual or anywhere else online. Would someone be willing to take a quick look at this and let me know how to code the priors the authors use, if it's possible?

Image

Re: how to incorporate asymmetrical priors

PostPosted: Fri Sep 10, 2010 10:09 am
by StephaneAdjemian
Hi I don't know this paper... and I am not sure to understand your problem. All the prior shapes considered in Dynare are asymmetric (except the gaussian and uniform of course). It's true that, in Dynare the prior hyperparameters are defined by the prior mean and the prior standard deviations (using some undocumented tricks it is also possible to define the hyperparameters from the prior mode and prior std). If you want to define the hyperparameters from the mean and the bounds of an interval you have to write a routine that compute the standard deviation from these three parameters (this routine can be called in the estimated_params block). We will add the possibility to define the prior hyperparameters using intervals in a next release of dynare.

Dynare automatically truncate the joint prior distribution so that the BK conditions are satisfied.

Best, Stéphane.

the solution

PostPosted: Fri Sep 10, 2010 3:58 pm
by jefflovejapan
Firstly, thank you very much for your reply. I went looking for a solution to this problem on a few different messageboards, including stackoverflow.com. One of the members there was kind enough to explain how to go about solving this problem. I'll post it below in case anyone else runs into the same problem.


The mean is A*B. So can you solve for perhaps A in terms of the mean(mu) and B?

Code: Select all
A = mu/B

Of course, this does no good unless you knew B. Or does it?

Look at your first expression. Can you substitute?

Code: Select all
gamcdf(2.11, mu/B, B) - gamcdf(1.61, mu/B, B) = 0.90


Does this get you any closer? Perhaps. There will be no useful symbolic solution available, except in terms of the incomplete gamma function itself. How do you solve a single equation numerically in one unknown in matlab? Use fzero.

Of course, fzero looks for a zero value. But by subtracting 0.90, that is resolved.

Can we define a function that fzero can use? Use a function handle.

Code: Select all
>> mu = 1.86;
>> gamfun = @(B) gamcdf(2.11, mu/B, B) - gamcdf(1.61, mu/B, B) - 0.90;


So try it. Before we do that, I always recommend plotting things.

Code: Select all
>> ezplot(gamfun)

Image

Hmm. That plot suggests that it might be difficult to find a zero of your function. If you do try it, you will find that good starting values for fzero are necessary here.

Sorry about my first try. Better starting values for fzero, plus some more plotting does give a gamma distribution that yields the desired shape.

Code: Select all
>> B = fzero(gamfun,[.0000001,.1])
B =
        0.0124760672290871
>> A = mu/B
A =
          149.085442218805
>> ezplot(@(x) gampdf(x,A,B))

Image

In fact this is a very "normal", i.e, Gaussian, looking curve.