<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/pva-publication-viability-analysis-round-3/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://peter.solymos.org/etc/2018/02/06/pva-publication-viability-analysis-round-3.html"> Peter Solymos - R related posts</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>A friend and colleague of mine, <a rel="nofollow" href="https://sites.google.com/site/pbatary/" target="_blank">Péter Batáry</a><br>
has circulated news from <a rel="nofollow" href="https://www.nature.com/articles/d41586-018-01374-x" target="_blank">Nature</a><br>
magazine about the EU freezing innovation funds to Bulgaria.<br>
The article had a figure about publication trends for<br>
Bulgaria, compared with Romania and Hungary.<br>
As I have blogged about such trends in ecology before<br>
(<a rel="nofollow" href="http://okologiablog.hu/node/219" target="_blank">here</a> and<br>
<a rel="nofollow" href="http://peter.solymos.org/etc/2016/08/30/my-first-blog-post-was-a-guest-post.html" target="_blank">here</a>),<br>
I felt the need to update my PVA models<br>
with two years worth of data from <a rel="nofollow" href="https://webofknowledge.com/" target="_blank">WoS</a>.</p>
<p>After downloading the yearly publications numbers<br>
using filters <code>ADDRESS=HUNGARY; CATEGORIES=ECOLOGY</code>,<br>
I started where I left off few years ago. I fit Ricker growth model<br>
to two time intervals of the data: 1978–1997, and 1998–2017.</p>
<p>The R code below uses the <a rel="nofollow" href="https://cran.r-project.org/package=PVAClone" target="_blank"><strong>PVAClone</strong></a> package<br>
that I wrote with <a rel="nofollow" href="https://www.researchgate.net/profile/Khurram_Nadeem" target="_blank">Khurram Nadeem</a>,<br>
and is based on fitting state-space models using<br>
MCMC and <a rel="nofollow" href="http://datacloning.org/" target="_blank">data cloning</a> with <a rel="nofollow" href="http://mcmc-jags.sourceforge.net/" target="_blank">JAGS</a>.<br>
The other <a rel="nofollow" href="https://cran.r-project.org/package=interval" target="_blank"><strong>intrval</strong></a> package is pretty new but handy little helper<br>
(see related posts <a rel="nofollow" href="http://peter.solymos.org/tags.html#intrval" target="_blank">here</a>)</p>
<div>
<div>
<pre><code><span>library</span><span>(</span><span>PVAClone</span><span>)</span><span>
</span><span>library</span><span>(</span><span>intrval</span><span>)</span><span>
</span><span>## the data from WoS</span><span>
</span><span>x</span><span> </span><span>&lt;-</span><span> </span><span>structure</span><span>(</span><span>list</span><span>(</span><span>years</span><span> </span><span>=</span><span> </span><span>1973</span><span>:</span><span>2017</span><span>,</span><span> </span><span>records</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>1</span><span>,</span><span> </span><span>0</span><span>,</span><span> </span><span>4</span><span>,</span><span> </span><span>0</span><span>,</span><span> </span><span>0</span><span>,</span><span>
</span><span>6</span><span>,</span><span> </span><span>2</span><span>,</span><span> </span><span>5</span><span>,</span><span> </span><span>4</span><span>,</span><span> </span><span>7</span><span>,</span><span> </span><span>5</span><span>,</span><span> </span><span>7</span><span>,</span><span> </span><span>3</span><span>,</span><span> </span><span>5</span><span>,</span><span> </span><span>9</span><span>,</span><span> </span><span>11</span><span>,</span><span> </span><span>20</span><span>,</span><span> </span><span>8</span><span>,</span><span> </span><span>10</span><span>,</span><span> </span><span>15</span><span>,</span><span> </span><span>29</span><span>,</span><span> </span><span>24</span><span>,</span><span> </span><span>53</span><span>,</span><span>
</span><span>12</span><span>,</span><span> </span><span>13</span><span>,</span><span> </span><span>30</span><span>,</span><span> </span><span>32</span><span>,</span><span> </span><span>36</span><span>,</span><span> </span><span>45</span><span>,</span><span> </span><span>39</span><span>,</span><span> </span><span>42</span><span>,</span><span> </span><span>43</span><span>,</span><span> </span><span>50</span><span>,</span><span> </span><span>62</span><span>,</span><span> </span><span>95</span><span>,</span><span> </span><span>106</span><span>,</span><span> </span><span>113</span><span>,</span><span> </span><span>83</span><span>,</span><span>
</span><span>108</span><span>,</span><span> </span><span>99</span><span>,</span><span> </span><span>89</span><span>,</span><span> </span><span>117</span><span>,</span><span> </span><span>111</span><span>,</span><span> </span><span>134</span><span>,</span><span> </span><span>127</span><span>)),</span><span> </span><span>.Names</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>&quot;years&quot;</span><span>,</span><span> </span><span>&quot;records&quot;</span><span>
</span><span>),</span><span> </span><span>row.names</span><span> </span><span>=</span><span> </span><span>c</span><span>(</span><span>NA</span><span>,</span><span> </span><span>45L</span><span>),</span><span> </span><span>class</span><span> </span><span>=</span><span> </span><span>&quot;data.frame&quot;</span><span>)</span><span>
</span><span>## fit the 2 models</span><span>
</span><span>ncl</span><span> </span><span>&lt;-</span><span> </span><span>10</span><span> </span><span># number of clones</span><span>
</span><span>m</span><span>1</span><span> </span><span>&lt;-</span><span> </span><span>pva</span><span>(</span><span>x</span><span>$</span><span>records</span><span>[</span><span>x</span><span>$</span><span>years</span><span> </span><span>%[]%</span><span> </span><span>c</span><span>(</span><span>1978</span><span>,</span><span> </span><span>1997</span><span>)],</span><span> </span><span>ricker</span><span>(</span><span>&quot;none&quot;</span><span>),</span><span> </span><span>ncl</span><span>)</span><span>
</span><span>m</span><span>2</span><span> </span><span>&lt;-</span><span> </span><span>pva</span><span>(</span><span>x</span><span>$</span><span>records</span><span>[</span><span>x</span><span>$</span><span>years</span><span> </span><span>%[]%</span><span> </span><span>c</span><span>(</span><span>1998</span><span>,</span><span> </span><span>2017</span><span>)],</span><span> </span><span>ricker</span><span>(</span><span>&quot;none&quot;</span><span>),</span><span> </span><span>ncl</span><span>)</span><span>
</span><span>## organize estimates</span><span>
</span><span>cf</span><span> </span><span>&lt;-</span><span> </span><span>data.frame</span><span>(</span><span>t</span><span>(</span><span>sapply</span><span>(</span><span>list</span><span>(</span><span>early</span><span>=</span><span>m</span><span>1</span><span>,</span><span> </span><span>late</span><span>=</span><span>m</span><span>2</span><span>),</span><span> </span><span>coef</span><span>)))</span><span>
</span><span>cf</span><span>$</span><span>K</span><span> </span><span>&lt;-</span><span> </span><span>with</span><span>(</span><span>cf</span><span>,</span><span> </span><span>-</span><span>a</span><span>/</span><span>b</span><span>)</span><span>
</span><span>## growth curve: early period</span><span>
</span><span>yr1</span><span> </span><span>&lt;-</span><span> </span><span>1978</span><span>:</span><span>1997</span><span>
</span><span>pr1</span><span> </span><span>&lt;-</span><span> </span><span>numeric</span><span>(</span><span>length</span><span>(</span><span>yr1</span><span>))</span><span>
</span><span>pr1</span><span>[</span><span>1</span><span>]</span><span> </span><span>&lt;-</span><span> </span><span>log</span><span>(</span><span>x</span><span>$</span><span>records</span><span>[</span><span>x</span><span>$</span><span>years</span><span>==</span><span>1978</span><span>])</span><span>
</span><span>for</span><span> </span><span>(</span><span>i</span><span> </span><span>in</span><span> </span><span>2</span><span>:</span><span>length</span><span>(</span><span>pr1</span><span>))</span><span>
</span><span>pr1</span><span>[</span><span>i</span><span>]</span><span> </span><span>&lt;-</span><span> </span><span>pr1</span><span>[</span><span>i</span><span>-1</span><span>]</span><span> </span><span>+</span><span> </span><span>cf</span><span>[</span><span>&quot;early&quot;</span><span>,</span><span> </span><span>&quot;a&quot;</span><span>]</span><span> </span><span>+</span><span> </span><span>cf</span><span>[</span><span>&quot;early&quot;</span><span>,</span><span> </span><span>&quot;b&quot;</span><span>]</span><span>*</span><span>exp</span><span>(</span><span>pr1</span><span>[</span><span>i</span><span>-1</span><span>])</span><span>
</span><span>pr1</span><span> </span><span>&lt;-</span><span> </span><span>exp</span><span>(</span><span>pr1</span><span>)</span><span>
</span><span>## growth curve: late period</span><span>
</span><span>yr2</span><span> </span><span>&lt;-</span><span> </span><span>1998</span><span>:</span><span>2017</span><span>
</span><span>pr2</span><span> </span><span>&lt;-</span><span> </span><span>numeric</span><span>(</span><span>length</span><span>(</span><span>yr2</span><span>))</span><span>
</span><span>pr2</span><span>[</span><span>1</span><span>]</span><span> </span><span>&lt;-</span><span> </span><span>log</span><span>(</span><span>x</span><span>$</span><span>records</span><span>[</span><span>x</span><span>$</span><span>years</span><span>==</span><span>1998</span><span>])</span><span>
</span><span>for</span><span> </span><span>(</span><span>i</span><span> </span><span>in</span><span> </span><span>2</span><span>:</span><span>length</span><span>(</span><span>pr2</span><span>))</span><span>
</span><span>pr2</span><span>[</span><span>i</span><span>]</span><span> </span><span>&lt;-</span><span> </span><span>pr2</span><span>[</span><span>i</span><span>-1</span><span>]</span><span> </span><span>+</span><span> </span><span>cf</span><span>[</span><span>&quot;late&quot;</span><span>,</span><span> </span><span>&quot;a&quot;</span><span>]</span><span> </span><span>+</span><span> </span><span>cf</span><span>[</span><span>&quot;late&quot;</span><span>,</span><span> </span><span>&quot;b&quot;</span><span>]</span><span>*</span><span>exp</span><span>(</span><span>pr2</span><span>[</span><span>i</span><span>-1</span><span>])</span><span>
</span><span>pr2</span><span> </span><span>&lt;-</span><span> </span><span>exp</span><span>(</span><span>pr2</span><span>)</span><span>
</span><span>## and finally the figure using base graphics</span><span>
</span><span>op</span><span> </span><span>&lt;-</span><span> </span><span>par</span><span>(</span><span>las</span><span>=</span><span>2</span><span>)</span><span>
</span><span>barplot</span><span>(</span><span>x</span><span>$</span><span>records</span><span>,</span><span> </span><span>names.arg</span><span> </span><span>=</span><span> </span><span>x</span><span>$</span><span>years</span><span>,</span><span> </span><span>space</span><span>=</span><span>0</span><span>,</span><span>
</span><span>ylab</span><span>=</span><span>&quot;# of publications&quot;</span><span>,</span><span> </span><span>xlab</span><span>=</span><span>&quot;years&quot;</span><span>,</span><span>
</span><span>col</span><span>=</span><span>ifelse</span><span>(</span><span>x</span><span>$</span><span>years</span><span> </span><span></span><span> </span><span>1998</span><span>,</span><span> </span><span>&quot;grey&quot;</span><span>,</span><span> </span><span>&quot;gold&quot;</span><span>))</span><span>
</span><span>lines</span><span>(</span><span>yr1</span><span>-</span><span>min</span><span>(</span><span>x</span><span>$</span><span>years</span><span>)</span><span>+0.5</span><span>,</span><span> </span><span>pr1</span><span>,</span><span> </span><span>col</span><span>=</span><span>4</span><span>)</span><span>
</span><span>abline</span><span>(</span><span>h</span><span>=</span><span>cf</span><span>[</span><span>&quot;early&quot;</span><span>,</span><span> </span><span>&quot;K&quot;</span><span>],</span><span> </span><span>col</span><span>=</span><span>4</span><span>,</span><span> </span><span>lty</span><span>=</span><span>3</span><span>)</span><span>
</span><span>lines</span><span>(</span><span>yr2</span><span>-</span><span>min</span><span>(</span><span>x</span><span>$</span><span>years</span><span>)</span><span>+0.5</span><span>,</span><span> </span><span>pr2</span><span>,</span><span> </span><span>col</span><span>=</span><span>2</span><span>)</span><span>
</span><span>abline</span><span>(</span><span>h</span><span>=</span><span>cf</span><span>[</span><span>&quot;late2017&quot;</span><span>,</span><span> </span><span>&quot;K&quot;</span><span>],</span><span> </span><span>col</span><span>=</span><span>2</span><span>,</span><span> </span><span>lty</span><span>=</span><span>3</span><span>)</span><span>
</span><span>par</span><span>(</span><span>op</span><span>)</span><span>
</span></code></pre>
</div>
</div>
<p><img alt="PVA" src="https://i1.wp.com/peter.solymos.org/images/2018/02/06/pva-3.png?w=456" data-recalc-dims="1"></p>
<p>Here are the model parameters for the two Ricker models:</p>
<table>
<thead>
<tr>
<th> </th>
<th><em>a</em></th>
<th><em>b</em></th>
<th><em>sigma</em></th>
<th><em>K</em></th>
</tr>
</thead>
<tbody>
<tr>
<td>1978–1997</td>
<td>0.38</td>
<td>-0.03</td>
<td>0.60</td>
<td>13.85</td>
</tr>
<tr>
<td>1998–2017</td>
<td>0.21</td>
<td>0.00</td>
<td>0.16</td>
<td>119.00</td>
</tr>
</tbody>
</table>
<p>The <em>K</em> carrying capacity used to be 100 based on<br>
1998–2012 data, but now <em>K</em> = 119, which is<br>
a significant improvement — heartfelt kudos to the ecologists in Hungary<br>
(more papers please)!<br>
The growth rate hasn’t changed (<em>a</em> = 0.21).<br>
So we can conclude that if the rate remained constant<br>
but carrying capacity increased, the change must be<br>
related to resource availability<br>
(i.e. increased funding, more jobs, improved infrastructure).</p>
<p>This is good news to me! Let me know what you think by leaving a comment below!</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://peter.solymos.org/etc/2018/02/06/pva-publication-viability-analysis-round-3.html"> Peter Solymos - R related posts</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/VKfTu6VQMDY" height="1"></a></div>