[Developers] Template functions and documentation

dave fournier davef at otter-rsch.com
Fri Jun 27 11:33:31 PDT 2014


On 06/27/2014 11:29 AM, Mark Maunder wrote:

OK,  so the asymptotic length is important.  What is your point?

     Dave


> Thanks Dave,
>
> We will probably use a reparameterization like this when we do the 
> analysis. Right now I am trying to get the function coding structure 
> sorted out before I write too much code.
>
> If you have a growth curve that is quite linear for the first few ages 
> and then bends over quickly, that would be useful. We have been 
> applying the Richards curve, but I think we might need to do better. 
> The issue is that the asymptotic length is quite important when 
> fitting to length composition data, but we often don't have much age 
> (or tagging) data for old fish. So, the asymptotic length is 
> controlled by the shape of the growth curve and the fit to the young 
> and intermediate aged fish.
>
> Regards,
>
> Mark
>
> *From:*dave fournier [mailto:davef at otter-rsch.com]
> *Sent:* Friday, June 27, 2014 11:11 AM
> *To:* Mark Maunder; developers at admb-project.org
> *Cc:* Alexandre Aires-Da-Silva; Carolina Minte-Vera
> *Subject:* Re: [Developers] Template functions and documentation
>
> On 06/27/2014 11:04 AM, Mark Maunder wrote:
>
> Its hard to believe that Schnute and I figured out how to do this 
> properly almost 34 years ago
> using punch cards on a machine with 18K user memory. Someone really 
> should figure out how to teach
> people the importance of parameterizing nonlinear models in a stable 
> fashion.
>
>
>
>     Hi developers,
>
>     I am in the process or putting together a model that will be used
>     to evaluate several growth equations so I thought I better try to
>     use the ADMB project "approved" approach for writing the
>     functions. Below is a template function and documentation for the
>     von Bertalanffy growth equation. I would appreciate any advice on
>     doing this "correctly".
>
>     Thanks,
>
>     Mark
>
>     /**
>
>     \defgroup CONTRIB Contributed libraries
>
>     */
>
>     /**
>
>     \ingroup CONTRIB
>
>     \defgroup CAPAM CAPAM created functions
>
>     */
>
>     #include <admodel.h>
>
>     /**  von Bertalanffy growth equation; constant objects.
>
>       \ingroup CAPAM
>
>       \brief Calculate the length from a given age based on the von
>     Bertalanffy equation. Written by Mark Maunder.
>
>       \param age age of individual, \f$a\f$.
>
>       \param Linf asymptotic length, \f$L_inf\f$.
>
>       \param K growth rate, \f$K\f$.
>
>       \param t0 age at zero length, \f$t_0\f$.
>
>       \return length predicted length of individual.
>     \f$L_inf*(1-exp(-K*(a-t0)))\f$.
>
>       */
>
>     template <typename type1, typename type1>
>
>     //can have multiple types so that they are used below in variable
>     definitions, they can differ between function calls, but remain
>     the same within a function call
>
>     //type1 is probably a long
>
>     //type2 is probably a dvariable (either a model parameter (Linf K
>     t0) or a derived variable (length))
>
>     //may need a type3, which is a dvar_vector if age and length are
>     vectors, where type 1 will be a vector
>
>     type1 vonB(const type1 &age, const type2 &Linf, const type2 &K,
>     const type2 &t0)
>
>     {
>
>       type2 length = Linf*(1.-mfexp(-K*(age-t0)));
>
>       return (length);
>
>     }
>
>     //is length a bad word to use
>
>     //do we use ingroup for both groups and subgroups in doxygen
>     documentation
>
>     //should we use mfexp?
>
>     //what if age and length are vectors, but age is a vector and
>     length is a dvar_vector, do we need to overload the type with one
>     with three variable types
>
>     //I couldn't work out how to put in the detailed description
>
>     //The equations did not work on my computer
>
>
>
>
>     _______________________________________________
>
>     Developers mailing list
>
>     Developers at admb-project.org  <mailto:Developers at admb-project.org>
>
>     http://lists.admb-project.org/mailman/listinfo/developers
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20140627/ae1a2ffb/attachment-0001.html>


More information about the Developers mailing list