[ADMB Users] Beta deviate
mintoc at gmail.com
Thu Aug 2 04:57:13 PDT 2012
Thanks very much for the code and explanation of the truncation.
Running beta_deviate(x,a,b,eps) returns:
Illegal value in inv_cumd_beta
Doing a search for "beta_deviate" in the source returns:
df1b2variable& _a,const df1b2variable& _b,
df1b2variable& _x,const df1b2variable& _a,
linad99/cbetdev.cpp:double beta_deviate(double a,double b,double x,double eps)
linad99/fvar.hpp:dvariable beta_deviate(const prevariable& _x,const
linad99/fvar.hpp:double beta_deviate(double x,double a,double b,double
linad99/vbetdev.cpp:dvariable beta_deviate(const prevariable& _a,const
So a mixture of positioning. inv_cumd_beta takes (a,b,x) in all cases
in the source.
Apologies for the back an forth, its a really useful general method
and I hope this contributes to the code.
On Wed, Aug 1, 2012 at 1:01 AM, dave fournier <davef at otter-rsch.com> wrote:
> On 12-07-31 11:02 AM, Coilin Minto wrote:
> One last thing. I checked the docs you referenced on beta_deviate. They are
> not quite accurate.
> The function is
> where eps has a default value of 1.e-7
> The reason for eps is that for some values of a or b the function and its
> go to infinity as x goes to 0 or 1. This can cause instability in the
> estimation procedure.
> To avoid this I added to option to fit a truncated beta which runs from eps
> to 1-eps
> The general ideas is that to avoid instability if it occurs one does the
> fitting in a number of stages
> and shrinks eps toward 0 after starting with something like eps=.001 at the
> first stage.
>> Hi Dave,
>> Thank you very much for the code.
>> I included the globals section:
>> #include <betai.cpp>
>> #include <dfbetai.cpp>
>> #include <df1b2invcumdbeta.cpp>
>> which gave the linking error:
>> g++ -s -L"/usr/local/admb"/lib -L"/usr/local/admb"/contrib fmi.o
>> -ldf1b2o -ladmod -lcontribo -ladt -lado -ldf1b2o -ladmod -ladt -lado
>> -lcontribo -o fmi
>> fmi.o: In function `betacf(prevariable const&, prevariable const&,
>> double, int)':
>> fmi.cpp:(.text+0x4a16): undefined reference to
>> `dvariable::operator=(df1_two_variable const&)'
>> collect2: ld returned 1 exit status
>> Commenting out:
>> //#include <dfbetai.cpp>
>> works, with the minor change of placing the random effect in the third
>> in contrast with the ADMB-RE manual.
>> It might be interesting to to get an example/benchmark together based
>> on the the binomial-beta model in Lee and Nelder (1996) using the data
>> in Crowder (1978).
>> Thanks very much for your time and help.
>> Best regards,
>> Crowder, M.J. (1978). Beta-binomial anova for proportions. Applied
>> Statistics, 27(1), 34-37.
>> Lee, Y. and Nelder, J.A. (1996). Hierarchical generalized linear
>> models. Journal of the Royal Statistical Society B, 58(4), 619-678.
>> On Mon, Jul 30, 2012 at 9:16 PM, dave fournier <davef at otter-rsch.com>
>>> Its really frustrating. I put a hell of a lot of work into that function
>>> it got wrecked.
>>> in the open sourcing fiasco. I have managed to get it to work again by
>>> purging a lot of the
>>> cephes code and reintroducing the old free world code.
>>> You can try compiling and linking these three files into your code and
>>> what happens.
>>> Users mailing list
>>> Users at admb-project.org
More information about the Users