[ADMB Users] Adjusted pow function for ADMB-RE
Stirrup, Oliver
oliver.stirrup.13 at ucl.ac.uk
Mon Nov 24 02:48:12 PST 2014
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':
<<< >>>
GLOBALS_SECTION
#include <admodel.h>
dvariable pow2(const dvariable & time, const dvariable & T)
{
if(time==0)
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
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20141124/bbe38c86/attachment.html>
More information about the Users
mailing list