A Question about the new Prior Sampler

As Dynare 4 is now the main version, this forum is now closed. Please, post
on the Dynare Help forum
Forum rules
As Dynare 4 is the current Dynare version, there forum is now close. Post new question in the Dynare Help Forum.

A Question about the new Prior Sampler

Postby bigbigben » Wed Mar 11, 2009 4:26 pm

Is there a typo around the area to use gamrnd or betarnd to draw values? The two matlab functions gamrnd and betarnd only accept scalar as input, but the generated gamma_index or beta_index are vectors.
bigbigben
 
Posts: 171
Joined: Sun May 28, 2006 1:19 am

Re: A Question about tof he new Prior Sampler

Postby StephaneAdjemian » Wed Mar 11, 2009 8:50 pm

Hi, Please correct me if I am wrong... The matlab stat toolbox is able to draw vectors (even matrices) of independent gamma or beta variates. What is the version of your statistical toolbox ?

I wrote an m file (also called gamrnd.m) to draw vectors of independent gamma variates. This file is located under /matlab/distributions/toolbox and this folder is written in the matlab's path by dynare if the stat toolbox is not detected.

Best,
Stéphane.

bigbigben wrote:Is there a typo around the area to use gamrnd or betarnd to draw values? The two matlab functions gamrnd and betarnd only accept scalar as input, but the generated gamma_index or beta_index are vectors.
Stéphane Adjemian
Université du Maine, GAINS and DynareTeam
https://stepan.adjemian.eu
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.

Re: A Question about the new Prior Sampler

Postby bigbigben » Thu Mar 12, 2009 3:30 am

Hi, I haven't tried the gamrnd used in matlab stat toolbox. What I am talking about is the gamrnd in Dynare 4.02. It doesn't take vectors as input. Below is what I get:

gamrnd(x,y)
??? Error using ==> gamrnd at 31
gamrnd: A and B should be scalar parameters.
bigbigben
 
Posts: 171
Joined: Sun May 28, 2006 1:19 am

Re: A Question about the new Prior Sampler

Postby StephaneAdjemian » Thu Mar 12, 2009 8:48 am

OK. The new prior sampler is in the trunk directory of our subversion repository (the future version 4.1 of dynare). The gamrnd function shipped with dynare 4.0.2 does not handle vector of gamma distributed draws but the new version (in the trunk) does.

The new version of gamrnd is also more general because, it can produce more efficiently random deviates when the parameter a is small (less than 1, in this case the gamma distribution is monotone decreasing and has an asymptote at zero). Also with the new version it is possible to simulate draws from the beta, when parameters a and b are such that the beta density has asymptotes at 0 and/or 1.

Best, Stéphane.
Stéphane Adjemian
Université du Maine, GAINS and DynareTeam
https://stepan.adjemian.eu
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.


Return to Dynare version 4

Who is online

Users browsing this forum: No registered users and 1 guest