<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/exploring-the-half-life-property-of-k/"></div></div><div><a data-url="http://www.r-bloggers.com/exploring-the-half-life-property-of-k/" data-counturl="http://www.r-bloggers.com/exploring-the-half-life-property-of-k/" data-count="horizontal" data-text="Exploring the Half-Life Property of K" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://derekogle.com/fishR/2016-06-12-Halflife-of-K"> fishR Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<hr>
<p>A colleague recently questioned whether the loge(2)/K, where K is the Brody growth coefficient in the typical parameterization of the von Bertalanffy growth function, represents the “amount of time it takes for a fish to grow from any length to a length halfway between the initial length and the asymptotic mean length (Linf)”. This phenomenon is briefly illustrated below.</p>
<ul>
<li>Create an R function for the typical von Bertalanffy growth function.</li>
</ul>
<figure>
<pre><code data-lang="r"><span>library</span><span>(</span><span>FSA</span><span>)</span>
<span>vb</span> <span>&lt;-</span> <span>vbFuns</span><span>()</span></code></pre>
</figure>
<ul>
<li>Declare some parameter values.</li>
</ul>
<figure>
<pre><code data-lang="r"><span>Linf</span> <span>&lt;-</span> <span>30</span>
<span>K</span> <span>&lt;-</span> <span>0.3</span>
<span>t0</span> <span>&lt;-</span> <span>-0.5</span></code></pre>
</figure>
<ul>
<li>Predict a mean length at the initial age.</li>
</ul>
<figure>
<pre><code data-lang="r"><span>initA</span> <span>&lt;-</span> <span>1</span>
<span>(</span> <span>initL</span> <span>&lt;-</span> <span>vb</span><span>(</span><span>initA</span><span>,</span><span>Linf</span><span>,</span><span>K</span><span>,</span><span>t0</span><span>)</span> <span>)</span></code></pre>
</figure>
<figure>
<pre><code data-lang="text">## [1] 10.87116</code></pre>
</figure>
<ul>
<li>Predict a mean length at the initial age plus loge(2)/K.</li>
</ul>
<figure>
<pre><code data-lang="r"><span>nextA</span> <span>&lt;-</span> <span>initA</span><span>+</span><span>log</span><span>(</span><span>2</span><span>)</span><span>/</span><span>K</span>
<span>(</span> <span>nextL</span> <span>&lt;-</span> <span>vb</span><span>(</span><span>nextA</span><span>,</span><span>Linf</span><span>,</span><span>K</span><span>,</span><span>t0</span><span>)</span> <span>)</span></code></pre>
</figure>
<figure>
<pre><code data-lang="text">## [1] 20.43558</code></pre>
</figure>
<ul>
<li>Find the length that is halfway between the initial length and Linf.</li>
</ul>
<figure>
<pre><code data-lang="r"><span>mean</span><span>(</span><span>c</span><span>(</span><span>initL</span><span>,</span><span>Linf</span><span>))</span></code></pre>
</figure>
<figure>
<pre><code data-lang="text">## [1] 20.43558</code></pre>
</figure>
<p>Note that these last two values are equal, which illustrates the statement above about the “half-life” meaning of K.</p>
<hr>
<p>This process is repeated below for several initial age values. Note that the differences between the predicted mean length at the new age and the point halfway between the initial length and Linf are equal (within machine precision) for each initial age. Again, illustrating the statement about K.</p>
<figure>
<pre><code data-lang="r"><span>initA</span> <span>&lt;-</span> <span>1</span><span>:</span><span>20</span>
<span>initL</span> <span>&lt;-</span> <span>vb</span><span>(</span><span>initA</span><span>,</span><span>Linf</span><span>,</span><span>K</span><span>,</span><span>t0</span><span>)</span>
<span>nextA</span> <span>&lt;-</span> <span>initA</span><span>+</span><span>log</span><span>(</span><span>2</span><span>)</span><span>/</span><span>K</span>
<span>nextL</span> <span>&lt;-</span> <span>vb</span><span>(</span><span>nextA</span><span>,</span><span>Linf</span><span>,</span><span>K</span><span>,</span><span>t0</span><span>)</span>
<span>testL</span> <span>&lt;-</span> <span>rowMeans</span><span>(</span><span>cbind</span><span>(</span><span>initL</span><span>,</span><span>Linf</span><span>))</span>
<span>cbind</span><span>(</span><span>nextL</span><span>,</span><span>testL</span><span>,</span><span>diff</span><span>=</span><span>nextL</span><span>-</span><span>testL</span><span>)</span></code></pre>
</figure>
<figure>
<pre><code data-lang="text">##          nextL    testL          diff
##  [1,] 20.43558 20.43558  0.000000e+00
##  [2,] 22.91450 22.91450  0.000000e+00
##  [3,] 24.75093 24.75093 -3.552714e-15
##  [4,] 26.11140 26.11140  0.000000e+00
##  [5,] 27.11925 27.11925  0.000000e+00
##  [6,] 27.86589 27.86589  0.000000e+00
##  [7,] 28.41901 28.41901  0.000000e+00
##  [8,] 28.82878 28.82878  0.000000e+00
##  [9,] 29.13234 29.13234  0.000000e+00
## [10,] 29.35722 29.35722  3.552714e-15
## [11,] 29.52382 29.52382  0.000000e+00
## [12,] 29.64723 29.64723 -3.552714e-15
## [13,] 29.73866 29.73866  0.000000e+00
## [14,] 29.80640 29.80640 -3.552714e-15
## [15,] 29.85658 29.85658 -3.552714e-15
## [16,] 29.89375 29.89375  0.000000e+00
## [17,] 29.92129 29.92129 -3.552714e-15
## [18,] 29.94169 29.94169  0.000000e+00
## [19,] 29.95680 29.95680  0.000000e+00
## [20,] 29.96800 29.96800  0.000000e+00</code></pre>
</figure>
<hr>
<p>The code below illustrates the same phenomenon for a very different set of parameter values.</p>
<figure>
<pre><code data-lang="r"><span>Linf</span> <span>&lt;-</span> <span>300</span>
<span>K</span> <span>&lt;-</span> <span>0.9</span>
<span>t0</span> <span>&lt;-</span> <span>1</span>
<span>initA</span> <span>&lt;-</span> <span>1</span><span>:</span><span>20</span>
<span>initL</span> <span>&lt;-</span> <span>vb</span><span>(</span><span>initA</span><span>,</span><span>Linf</span><span>,</span><span>K</span><span>,</span><span>t0</span><span>)</span>
<span>nextA</span> <span>&lt;-</span> <span>initA</span><span>+</span><span>log</span><span>(</span><span>2</span><span>)</span><span>/</span><span>K</span>
<span>nextL</span> <span>&lt;-</span> <span>vb</span><span>(</span><span>nextA</span><span>,</span><span>Linf</span><span>,</span><span>K</span><span>,</span><span>t0</span><span>)</span>
<span>testL</span> <span>&lt;-</span> <span>rowMeans</span><span>(</span><span>cbind</span><span>(</span><span>initL</span><span>,</span><span>Linf</span><span>))</span>
<span>cbind</span><span>(</span><span>nextL</span><span>,</span><span>testL</span><span>,</span><span>diff</span><span>=</span><span>nextL</span><span>-</span><span>testL</span><span>)</span></code></pre>
</figure>
<figure>
<pre><code data-lang="text">##          nextL    testL          diff
##  [1,] 150.0000 150.0000 -2.842171e-14
##  [2,] 239.0146 239.0146  0.000000e+00
##  [3,] 275.2052 275.2052  0.000000e+00
##  [4,] 289.9192 289.9192  0.000000e+00
##  [5,] 295.9014 295.9014  0.000000e+00
##  [6,] 298.3337 298.3337  0.000000e+00
##  [7,] 299.3225 299.3225  0.000000e+00
##  [8,] 299.7246 299.7246  5.684342e-14
##  [9,] 299.8880 299.8880  0.000000e+00
## [10,] 299.9545 299.9545  0.000000e+00
## [11,] 299.9815 299.9815  0.000000e+00
## [12,] 299.9925 299.9925  0.000000e+00
## [13,] 299.9969 299.9969  5.684342e-14
## [14,] 299.9988 299.9988  0.000000e+00
## [15,] 299.9995 299.9995  0.000000e+00
## [16,] 299.9998 299.9998  0.000000e+00
## [17,] 299.9999 299.9999  5.684342e-14
## [18,] 300.0000 300.0000  0.000000e+00
## [19,] 300.0000 300.0000  0.000000e+00
## [20,] 300.0000 300.0000  0.000000e+00</code></pre>
</figure>
<hr>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/exploring-the-half-life-property-of-k/"></div></div><div><a data-url="http://www.r-bloggers.com/exploring-the-half-life-property-of-k/" data-counturl="http://www.r-bloggers.com/exploring-the-half-life-property-of-k/" data-count="vertical" data-text="Exploring the Half-Life Property of K" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://derekogle.com/fishR/2016-06-12-Halflife-of-K"> fishR Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/lUhZYcDCxDU"></a></div>