[ADMB Users] Beta deviate

dave fournier davef at otter-rsch.com
Tue Jul 31 17:01:27 PDT 2012


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

   beta_deviate(x,a,b,eps)

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 derivatives
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:
>
> 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 position
>
> beta_deviate(a,b,u);
>
> 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,
> Coilin
>
> References:
>
> 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> wrote:
>> Its really frustrating. I put a hell of a lot of work into that function and
>> 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 see
>> what happens.
>>
>> _______________________________________________
>> Users mailing list
>> Users at admb-project.org
>> http://lists.admb-project.org/mailman/listinfo/users
>>




More information about the Users mailing list