<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 06/27/2014 11:04 AM, Mark Maunder
wrote:<br>
<br>
Its hard to believe that Schnute and I figured out how to do this
properly almost 34 years ago<br>
using punch cards on a machine with 18K user memory. Someone
really should figure out how to teach<br>
people the importance of parameterizing nonlinear models in a
stable fashion.<br>
<br>
<br>
<br>
<br>
</div>
<blockquote
cite="mid:235aeee8-a6b0-4051-9f1d-82f8b382d2bc@MAIL1.lajolla.iattc.org"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi developers,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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”.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Mark<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">/**<o:p></o:p></p>
<p class="MsoNormal">\defgroup CONTRIB Contributed libraries<o:p></o:p></p>
<p class="MsoNormal">*/<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">/**<o:p></o:p></p>
<p class="MsoNormal">\ingroup CONTRIB <o:p></o:p></p>
<p class="MsoNormal">\defgroup CAPAM CAPAM created functions<o:p></o:p></p>
<p class="MsoNormal">*/<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#include <admodel.h><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">/** von Bertalanffy growth equation;
constant objects.<o:p></o:p></p>
<p class="MsoNormal"> \ingroup CAPAM<o:p></o:p></p>
<p class="MsoNormal"> \brief Calculate the length from a given
age based on the von Bertalanffy equation. Written by Mark
Maunder.<o:p></o:p></p>
<p class="MsoNormal"> \param age age of individual, \f$a\f$.<o:p></o:p></p>
<p class="MsoNormal"> \param Linf asymptotic length,
\f$L_inf\f$.<o:p></o:p></p>
<p class="MsoNormal"> \param K growth rate, \f$K\f$.<o:p></o:p></p>
<p class="MsoNormal"> \param t0 age at zero length, \f$t_0\f$.<o:p></o:p></p>
<p class="MsoNormal"> \return length predicted length of
individual. \f$L_inf*(1-exp(-K*(a-t0)))\f$.<o:p></o:p></p>
<p class="MsoNormal"> */<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">template <typename type1, typename
type1> <o:p></o:p></p>
<p class="MsoNormal">//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
<o:p></o:p></p>
<p class="MsoNormal">//type1 is probably a long<o:p></o:p></p>
<p class="MsoNormal">//type2 is probably a dvariable (either a
model parameter (Linf K t0) or a derived variable (length))
<o:p></o:p></p>
<p class="MsoNormal">//may need a type3, which is a dvar_vector
if age and length are vectors, where type 1 will be a vector<o:p></o:p></p>
<p class="MsoNormal">type1 vonB(const type1 &age, const
type2 &Linf, const type2 &K, const type2 &t0)<o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"> type2 length =
Linf*(1.-mfexp(-K*(age-t0)));<o:p></o:p></p>
<p class="MsoNormal"> return (length);<o:p></o:p></p>
<p class="MsoNormal">} <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">//is length a bad word to use<o:p></o:p></p>
<p class="MsoNormal">//do we use ingroup for both groups and
subgroups in doxygen documentation<o:p></o:p></p>
<p class="MsoNormal">//should we use mfexp?<o:p></o:p></p>
<p class="MsoNormal">//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<o:p></o:p></p>
<p class="MsoNormal">//I couldn't work out how to put in the
detailed description<o:p></o:p></p>
<p class="MsoNormal">//The equations did not work on my computer
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a>
</pre>
</blockquote>
<br>
</body>
</html>