<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:39 AM, Mark Maunder
wrote:<br>
<br>
<br>
Mark,<br>
<br>
If it is linear for young fish and vonb for older fish then the
linear part is only important in so much as<br>
it helps determine the length of the first age class for which the
von b is used. So one could still parameterize the model as<br>
<br>
l_1, l_mid, l_n, and rho where<br>
<br>
l_1 is the mean length of the first age class, l_n is the mean
length of the last age class and l_mid is the mean length of the
first<br>
age class for which the VB is used.<br>
<br>
All this will also work for Richards etc. I suppose I'm being
difficult but the net is full of people fitting these curves<br>
with bad parameterization and having trouble. People are taught
to parameterizae their curves with the parameters<br>
of interest rather than use stable parameterizations and then
solve for the parametres of interest as dependent variables.<br>
<br>
a major problme is that r offers no support for this superior
approach especially when it comes to random effects models.<br>
Just another reason why R sucks.<br>
<br>
Dave<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
<blockquote
cite="mid:0e2a28ac-a7d5-4955-95bc-f75315446f05@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;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Times New Roman \, serif";}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 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";
color:black;}
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;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";
color:black;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@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"><span style="color:#1F497D">Dave,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">The point is
that the asymptotic length is controlled by the shape of the
growth curve and the fit to the young and intermediate aged
fish. For example, if you fit a vonB only to young fish that
show linear growth you get a very large Linf. The more
flexible Richards curve does better, but I don’t think it
bends over fast enough for the data I have. I have created a
composite growth model that is linear for young fish and
vonB for old fish, but I was wondering if there is a better
model out there that I don’t know about.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Mark </span><span
style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
dave fournier [<a class="moz-txt-link-freetext" href="mailto:davef@otter-rsch.com">mailto:davef@otter-rsch.com</a>]
<br>
<b>Sent:</b> Friday, June 27, 2014 11:34 AM<br>
<b>To:</b> Mark Maunder; <a class="moz-txt-link-abbreviated" href="mailto:developers@admb-project.org">developers@admb-project.org</a><br>
<b>Cc:</b> Alexandre Aires-Da-Silva; Carolina Minte-Vera<br>
<b>Subject:</b> Re: [Developers] Template functions and
documentation<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">On
06/27/2014 11:29 AM, Mark Maunder wrote:<br>
<br>
OK, so the asymptotic length is important. What is your
point?<br>
<br>
Dave<br>
<br>
<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:#1F497D">Thanks Dave,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">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.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">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. </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Regards, </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Mark </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
dave fournier [<a moz-do-not-send="true"
href="mailto:davef@otter-rsch.com">mailto:davef@otter-rsch.com</a>]
<br>
<b>Sent:</b> Friday, June 27, 2014 11:11 AM<br>
<b>To:</b> Mark Maunder; <a moz-do-not-send="true"
href="mailto:developers@admb-project.org">developers@admb-project.org</a><br>
<b>Cc:</b> Alexandre Aires-Da-Silva; Carolina
Minte-Vera<br>
<b>Subject:</b> Re: [Developers] Template functions
and documentation</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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>
<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<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>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman , serif","serif""><br>
<br>
<br>
<br>
</span><o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Developers mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:Developers@admb-project.org">Developers@admb-project.org</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://lists.admb-project.org/mailman/listinfo/developers">http://lists.admb-project.org/mailman/listinfo/developers</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New Roman
, serif","serif""> </span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif""><o:p> </o:p></span></p>
</div>
</blockquote>
<br>
</body>
</html>