[ADMB Users] Adjusted pow function for ADMB-RE

Steve Martell SteveM at iphc.int
Mon Nov 24 08:13:16 PST 2014

Make sure the arguments of the function are also df1b2variable

Sent from my iPad

On Nov 24, 2014, at 2:51 AM, Stirrup, Oliver <oliver.stirrup.13 at ucl.ac.uk<mailto:oliver.stirrup.13 at ucl.ac.uk>> wrote:

Hello all

I have found that use of the ‘pow’ function causes executables created by ADMB to crash when the first argument is zero, i.e. when a calculation of 0^x is attempted.

In my template files, data relating to a time variable are read into a dvar_vector and (within a loop) each element of this vector is then raised to the power of a model parameter. The time variable is positive in most cases, but occasionally takes the value of zero, leading to the problem described.

Using the standard mode for ADMB, I have overcome this problem by defining the following function to replace ‘pow’:

<<< >>>


  #include <admodel.h>

  dvariable pow2(const dvariable & time, const dvariable & T)
    return 0;
  else return pow(time,T);

<<< >>>

I would now like to implement a similar solution for the random effects mode of ADMB, but have so far been unsuccessful in my attempts, with a large number of error messages on compilation. I think that my problem lies in the fact that I do not really understand how to define and manipulate df1b2variable objects.

If anyone can offer a solution or any advice regarding this problem, I would be very grateful.

Best wishes


Oliver Stirrup
PhD Student

MRC Clinical Trials Unit at UCL
Institute of Clinical Trials & Methodology
London  UK
e-mail:                          oliver.stirrup.13 at ucl.ac.uk

Users mailing list
Users at admb-project.org<mailto:Users at admb-project.org>


This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary) and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations Immunities Act, 22 U.S.C. Sec. 288 et seq.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20141124/64439ca6/attachment.html>

More information about the Users mailing list