<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Statforbiology</title>
<link>https://www.statforbiology.com/</link>
<atom:link href="https://www.statforbiology.com/index.xml" rel="self" type="application/rss+xml"/>
<description>Fixing the bridge between biologists and statisticians</description>
<generator>quarto-1.9.37</generator>
<lastBuildDate>Sun, 19 Jul 2026 22:00:00 GMT</lastBuildDate>
<item>
  <title>Finally migrating to Quarto</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/news_SwitchToQuarto.html</link>
  <description><![CDATA[ 





<p>A few months ago, my <strong>blogdown</strong>-based blogs started giving me a few headaches, after more than seven years of remarkably reliable service. After doing some research on the web and consulting a few AI assistants, it became clear that the main issue was the theme, which had not been updated for quite some time and had started to show incompatibilities with recent versions of the <strong>Hugo</strong> static site generator.</p>
<p>It did not seem likely that the theme would receive further updates, as the project appeared to have been abandoned. At that point, I had two options: migrate to a new Hugo theme or port the entire blog to <strong>Quarto</strong>. Since updating the theme would probably have required an amount of work comparable to migrating the whole website, I decided to give Quarto a try. After a few experiments, I was pleasantly surprised: Quarto proved to be flexible, logical, and easy to understand—even for an old dinosaur like me.</p>
<p>I soon discovered that most of the existing posts could be migrated with relatively little effort. Nevertheless, I decided to take this opportunity to review all the old posts, checking them carefully and updating or expanding them wherever necessary. This process will take some time, but I hope to complete it before the start of the new academic semester.</p>
<p>In the meantime, if you happen to find missing posts, broken links, or other glitches, please forgive me and feel free to send me a message using the email address below.</p>
<p>Thank you very much for your patience. Please stay tuned—and don’t forget to have a look at my new book!</p>
<p>Prof.&nbsp;Andrea Onofri <br> Department of Agricultural, Food and Environmental Sciences<br> University of Perugia (Italy)<br> Send comments to: <a href="mailto:andrea.onofri@unipg.it">andrea.onofri@unipg.it</a> <br></p>
<p><a href="https://www.awin1.com/cread.php?awinmid=26429&amp;awinaffid=2675822&amp;ued=https%3A%2F%2Flink.springer.com%2Fbook%2F10.1007%2F978-3-032-08199-5"><img src="https://www.statforbiology.com/Figures/Email_Signature_978-3-032-08199-5.png" alt="Book cover" class="cover" align="center"></a> <br></p>



 ]]></description>
  <category>News</category>
  <guid>https://www.statforbiology.com/posts/news_SwitchToQuarto.html</guid>
  <pubDate>Sun, 19 Jul 2026 22:00:00 GMT</pubDate>
  <media:content url="https://www.statforbiology.com/Figures/logo.png" medium="image" type="image/png" height="57" width="144"/>
</item>
<item>
  <title>Migration from Blogdown to Quarto</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/R_QuartoSteps.html</link>
  <description><![CDATA[ 





<p>More than twenty-five years ago, I had the idea that having a website would be a good way to store my teaching and research materials, keep them organised, retrieve them easily, and share them with students and colleagues.</p>
<p>Since then, I have explored a variety of different solutions, ranging from a website written entirely in HTML to content management systems such as Blogger and WordPress. When I discovered the <code>blogdown</code> package, it felt both like paradise and like hell. Paradise because it allowed me to combine text and code into attractive webpages; hell because of the difficulties I experienced in shaping the blog to suit my needs and preferences. I have given an account of the initial difficulties</p>
<p>More recently, I decided to migrate to Quarto for two main reasons. First, the theme I had been using had not been updated for quite some time and had started exhibiting odd behaviour under certain circumstances. Second, I wanted to avoid the intrinsic complexity and rigidity of Hugo.</p>
<p>This post is intended as a diary of my migration notes. Its purpose is to help me keep track of the changes I made to my original website and, if necessary, reproduce them should I ever get stuck during the process.</p>
<section id="step-1-getting-started-with-quarto" class="level1">
<h1>Step 1: Getting started with ‘Quarto’</h1>
<p>First, I used the RStudio Quick Start (File|New project) to create a Quarto blog in a separate project folder from my original blogdown website folder. This was very easy!</p>
</section>
<section id="step-2-where-do-i-put-my-posts" class="level1">
<h1>Step 2: Where do I put my posts?</h1>
<p>This was also easy and logic: blog posts, as ‘.qmd’ sorce files need to be put in the ‘posts’ folder.</p>
</section>
<section id="step-3-where-do-i-put-my-non-post-pages" class="level1">
<h1>Step 3: Where do I put my non-post pages?</h1>
<p>My blog also contains static pages, such as articles, tutorials, a project page, links and other stuff. I put the source code for these pages, as .qmd’ files in the root project folder so that they could be rendered as ‘.html’ files in the root folder of the website. Tutorials, books or other projects rendered as self-contained website folders, were also put in the root project folder. All these pages which are not under the ‘posts’ folder are not listed together with the other post in the home page of the blog, but they are easy to link, considering that Quarto directly translates the source folder structure into the website URL structure. However, static folders need to be listed as ‘resources’ in the ‘_quarto.yml’ configuration file, as shown below.</p>
<pre><code>project:
  type: website
  resources:
    - folder1
    - folder2
    - folder3</code></pre>
<p>In this vein, I have also added figures and other materials, which I need to link in webpages and posts, to the ‘Figure’ folder, within the root project folder, by using the markdown syntax that follows.</p>
<pre><code>![caption](../Figures/logo.jpg)</code></pre>
<p>Alternatively, the <code>include_graphics()</code> function in the <code>knitr</code> package can be used with increased flexibility.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1">knitr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">include_graphics</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"../Figures/logo.jpg"</span>)</span></code></pre></div></div>
</div>
</section>
<section id="step-4-support-for-literature-citations" class="level1">
<h1>Step 4: Support for literature citations</h1>
<p>Whenever I need to cite literature references in a post or other page, I simply need to refer to the literature file (‘.bib’) and the the ‘.csl’ file in the YAML header of the whole project (_quarto.yml), e.g., :</p>
<pre><code>bibliography: myFile.bib
csl: myStyle.csl</code></pre>
<p>Lately, I can cite by using <code>pandoc-citeproc</code>.</p>
</section>
<section id="step-5-latex-equations" class="level1">
<h1>Step 5: Latex equations</h1>
<p>While this was initially a problem with ‘blogdown’, latex equations are natively supported and included in ‘quarto’, as shown below.</p>
<pre><code>$$Y = a \, \exp{\left(-b \, t\right)}$$</code></pre>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20%5C,%20%5Cexp%7B%5Cleft(-b%20%5C,%20t%5Cright)%7D"></p>
</section>
<section id="step-6-creating-entries-for-the-navigation-bar" class="level1">
<h1>Step 6: Creating entries for the navigation bar</h1>
<p>This was very simple, as the navigation bar is managed within the ‘_quarto.yml’ configuration file. For example, for this blog, the navigation bar is defined as follows.</p>
<pre><code>website:
  navbar:
    left:
      - aboutThis.qmd
      - about.qmd
      - text: "Posts"
        href: index.html
      - tutorials.qmd
      - Rpackages.qmd
      - links.qmd
    right:  
      - icon: github
        href: https://github.com/OnofriAndreaPG
      - icon: bluesky
        href: https://bsky.app/profile/statforbiology.bsky.social</code></pre>
</section>
<section id="step-7-adding-an-rss-feed" class="level1">
<h1>Step 7: Adding an RSS Feed</h1>
<p>This was super-easy! An RSS is produced by default, although I wanted to have a second feed containing only posts in one specific category (‘R’). What I had to do was to modify the YAML matter on the ‘index.qmd’ file, which was already available whitin the root project directory, as shown below.</p>
<pre><code>listing:
  contents: posts
  categories: true
  sort: "date desc"
  type: default
  sort-ui: false
  filter-ui: false
  feed:
    categories:
      - R</code></pre>
<p>My blog is listed on R Bloggers, which receives the feed from ‘/tags/r/index.xml’, while my feed for the R category is now produced as ‘/index-r.xml’. I did not want to change my subscription to R bloggers, and thus I used the automated script execution to have R copy the RSS feed from ‘/index-r.xml’ to ‘/tags/r/index.xml’, so that the second file is an exact copy of the first one. To do so I had to add the following line to the ‘_quarto.yml’ configuration file:</p>
<pre><code>project:
  type: website
  post-render:
    - Rscript copy-feed.R</code></pre>
<p>Finally I crated the R script file ‘copy-feed.R’ in the root project folder, containing the following functions:</p>
<pre><code>dir.create("_site/tags/r", recursive = TRUE, showWarnings = FALSE)

file.copy(
  "_site/index-R.xml",
  "_site/tags/r/index.xml",
  overwrite = TRUE
)</code></pre>
</section>
<section id="step-9---google-analytics-622019" class="level1">
<h1>Step 9 - Google Analytics (6/2/2019)</h1>
<p>Also for the new blog, I would like to track the visits I receive. I went to Google Analytics to recover my tracking ID and I added such an information to the ’_quarto.yml’ configuration file.</p>
<pre><code>website:
  google-analytics: "G-myID"</code></pre>


</section>

 ]]></description>
  <category>R</category>
  <category>Quarto</category>
  <guid>https://www.statforbiology.com/posts/R_QuartoSteps.html</guid>
  <pubDate>Tue, 14 Jul 2026 22:00:00 GMT</pubDate>
</item>
<item>
  <title>Field Research methods in Agriculture</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/news_NewBook.html</link>
  <description><![CDATA[ 





<p>Hi everybody, I have exciting news!</p>
<p>After a few months of silence, I’m thrilled to finally share the reason of such silence: I’ve been working intensely on a new book project, which has taken up most of my spare time. And now… the book is out!</p>
<p>This book is titled ‘Field Research Methods in Agriculture’ and it is published by Springer Nature. It offers a clear, accessible, and practical introduction to experimental design and basic data analysis for field experiments in agriculture and related disciplines. It’s specifically designed for students, researchers, and practitioners who want to strengthen their methodological skills without getting lost in heavy mathematics.</p>
<p>And, why this book matters?</p>
<p>Small-plot experiments are the backbone of scientific progress in agriculture. They support the evaluation and comparison of innovative genotypes, agronomic practices, pesticides, and plant protection methods. This book provides the tools to design, analyze, and interpret such experiments correctly and effectively.</p>
<p>What’s inside?</p>
<ul>
<li>Experimental design and layout types</li>
<li>Descriptive statistics</li>
<li>Model fitting (ANOVA, regression, mixed models)</li>
<li>Stochastic models (Gaussian density, Monte Carlo simulation)</li>
<li>Inference and hypothesis testing</li>
<li>Model evaluation</li>
<li>Combinations of model parameters</li>
</ul>
<p>… all supported by real-life examples and hands-on exercises.</p>
<p>The book is complemented by:</p>
<ul>
<li>an R package (<code>statforbiology</code>)</li>
<li>a continuously updated webpage with extra functions, datasets, and case studies (<a href="https://www.statforbiology.com/_statbookeng/">at this link</a>)</li>
</ul>
<p>My hope is that this resource will become a practical companion for those working with field data in agriculture and related fields.</p>
<p>If you’re interested, I’d be delighted to share more! If you would like to take a look, please <a href="https://www.awin1.com/cread.php?awinmid=26429&amp;awinaffid=2675822&amp;ued=https%3A%2F%2Flink.springer.com%2Fbook%2F10.1007%2F978-3-032-08199-5">visit the Springer publication website for the table of contents and sample chapters or to buy the whole book or any of its individual Chapters</a>.</p>
<p>Thank you very much for your attention!</p>
<p>Prof.&nbsp;Andrea Onofri<br>
Department of Agricultural, Food and Environmental Sciences<br>
University of Perugia (Italy)<br>
Send comments to: <a href="mailto:andrea.onofri@unipg.it">andrea.onofri@unipg.it</a></p>
<p><a href="https://www.awin1.com/cread.php?awinmid=26429&amp;awinaffid=2675822&amp;ued=https%3A%2F%2Flink.springer.com%2Fbook%2F10.1007%2F978-3-032-08199-5"><img src="https://www.statforbiology.com/Figures/Email_Signature_978-3-032-08199-5.png" alt="Book cover" class="cover" align="center"></a> <br></p>



 ]]></description>
  <category>News</category>
  <guid>https://www.statforbiology.com/posts/news_NewBook.html</guid>
  <pubDate>Mon, 24 Nov 2025 23:00:00 GMT</pubDate>
</item>
<item>
  <title>Some useful equations for nonlinear regression in R</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/nls_usefulEquations.html</link>
  <description><![CDATA[ 





<p>Biological phenomena are often studied by examining how a numerical variable, usually called the <em>response</em> (e.g., the weight or height of an organism), is affected by another variable, usually called the <em>predictor</em> (e.g., time or fertiliser application rate). These ‘predictor-response’ relationships are commonly described using <strong>models</strong>, which express the response as a mathematical function of the predictor. In general, a model can be written as:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20f(X,%20%5Ctheta)"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?Y"> is the response, <img src="https://latex.codecogs.com/png.latex?X"> is the predictor, and <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> is a collection of parameters, usually denoted by symbols, such as the letters of the Roman or Greek alphabet. The element <img src="https://latex.codecogs.com/png.latex?f"> is the <em>function</em>, which determines the shape of the relationship when plotted on an <em>x–y</em> graph.</p>
<p>Because mathematical modelling plays such a central role in biology and many other scientific disciplines, biologists need to be familiar with the most important mathematical functions. More importantly, they need to be able to “read” these functions and use their parameters to describe, interpret, and quantify biological processes. With this aim in mind, I have compiled a collection of the mathematical functions most commonly encountered in biology, explaining the meaning of their parameters, with particular emphasis on their biological interpretation rather than their mathematical properties.</p>
<section id="curve-shapes" class="level1">
<h1>Curve shapes</h1>
<p>Functions are often classified according to the shape they exhibit when plotted on an <em>x–y</em> graph. This approach is adopted, for example, in Ratkowsky (1990), and the classification presented below is largely based on that work.</p>
<ul>
<li>Polynomials
<ol type="1">
<li>Straight line function</li>
<li>Quadratic polynomial function</li>
</ol></li>
<li>Concave/Convex curves (no inflection)
<ol type="1">
<li>Exponential function</li>
<li>Asymptotic function / Negative exponential function</li>
<li>Power curve function</li>
<li>Logarithmic function</li>
<li>Rectangular hyperbola</li>
</ol></li>
<li>Sigmoidal curves
<ol type="1">
<li>Logistic function</li>
<li>Gompertz function</li>
<li>Modified Gompertz function</li>
<li>Log-logistic function</li>
<li>Weibull (type 1) function</li>
<li>Weibull (type 2) function</li>
</ol></li>
<li>Curves with maxima/minima
<ol type="1">
<li>Bragg function</li>
<li>Lorentz function</li>
<li>Beta function</li>
</ol></li>
</ul>
<p>have chosen to include a relatively large number of functions, so this post is necessarily rather long. To make navigation easier, you can first inspect Figure 1 to identify the type of curve of interest and then use the links above to jump directly to the corresponding section.</p>
<p>Throughout this post, <img src="https://latex.codecogs.com/png.latex?X"> denotes the predictor, <img src="https://latex.codecogs.com/png.latex?Y"> the response, and the letters of the Roman alphabet (<img src="https://latex.codecogs.com/png.latex?a">, <img src="https://latex.codecogs.com/png.latex?b">, <img src="https://latex.codecogs.com/png.latex?c">, …) the model parameters, which determine the shape of the function.</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-1" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://www.statforbiology.com/posts/nls_usefulEquations_files/figure-html/fig-1-1.png" class="img-fluid figure-img" style="width:95.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The shapes of the most important functions
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="polynomials" class="level1">
<h1>Polynomials</h1>
<p>Polynomials form a class of their own because their flexible shapes allow them to approximate a wide variety of biological processes, at least over a restricted range of the predictor. The mathematical tractation is very simple, but their main limitation is that they cannot describe asymptotic processes, which are extremely common in biology. Moreover, as the polynomial degree increases, their shapes become increasingly complex and often lack a meaningful biological interpretation.</p>
<section id="straight-line-function" class="level2">
<h2 class="anchored" data-anchor-id="straight-line-function">Straight-line function</h2>
<p>The simplest polynomial is the straight line, with equation:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20+%20bX%20%5Cqquad%5Cqquad%20(1)"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?a"> is the value of <img src="https://latex.codecogs.com/png.latex?Y"> when <img src="https://latex.codecogs.com/png.latex?X%20=%200">, and <img src="https://latex.codecogs.com/png.latex?b"> is the slope, that is, the change in <img src="https://latex.codecogs.com/png.latex?Y"> associated with a one-unit increase in <img src="https://latex.codecogs.com/png.latex?X">. When <img src="https://latex.codecogs.com/png.latex?b%3E0">, <img src="https://latex.codecogs.com/png.latex?Y"> increases as <img src="https://latex.codecogs.com/png.latex?X"> increases; when <img src="https://latex.codecogs.com/png.latex?b%3C0">, it decreases.</p>
<p>Because of their simplicity, straight lines are mainly used to approximate biological responses over a limited range of the predictor.</p>
</section>
<section id="quadratic-polynomial-function" class="level2">
<h2 class="anchored" data-anchor-id="quadratic-polynomial-function">Quadratic polynomial function</h2>
<p>The quadratic polynomial is described by the equation:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20+%20bX%20+%20cX%5E2%20%5Cqquad%5Cqquad%20(2)"></p>
<p>This equation describes a U-shaped curve (a parabola), which may open upwards or downwards depending on the sign of <img src="https://latex.codecogs.com/png.latex?c">. If <img src="https://latex.codecogs.com/png.latex?c%3E0">, the parabola opens upwards; otherwise, it opens downwards.</p>
<p>The parameter <img src="https://latex.codecogs.com/png.latex?a"> represents the value of <img src="https://latex.codecogs.com/png.latex?Y"> when <img src="https://latex.codecogs.com/png.latex?X=0">, whereas <img src="https://latex.codecogs.com/png.latex?b"> and <img src="https://latex.codecogs.com/png.latex?c"> determine how the response changes as the predictor varies. To better understand the role of these parameters, we can examine the first derivative of Eq. (2). In R, this can be obtained with the <code>D()</code> function, which differentiates an expression with respect to a specified variable:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">D</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">expr =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expression</span>(a <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> b<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>X <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> c<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>X<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">name =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"X"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>b + c * (2 * X)</code></pre>
</div>
</div>
<p>The derivative is not constant but varies with the value of <img src="https://latex.codecogs.com/png.latex?X"> and, in particular, <img src="https://latex.codecogs.com/png.latex?b"> represent the variation of <img src="https://latex.codecogs.com/png.latex?Y"> around the point <img src="https://latex.codecogs.com/png.latex?X%20=%200">. The stationary point, that is, the point where the derivative is zero, occurs at:</p>
<p><img src="https://latex.codecogs.com/png.latex?X_m%20=%20-%5Cfrac%7Bb%7D%7B2c%7D"></p>
<p>This point is a <strong>minimum</strong> when <img src="https://latex.codecogs.com/png.latex?c%3E0"> and a <strong>maximum</strong> when <img src="https://latex.codecogs.com/png.latex?c%3C0">.</p>
<p>The corresponding response is</p>
<p><img src="https://latex.codecogs.com/png.latex?Y_%7B%5Ctextrm%7Bmax%7D%7D%20=%20%5Cfrac%7B4ac-b%5E2%7D%7B4c%7D"></p>
<p>In practice, biologists often use only one branch of the parabola to approximate biological responses showing either a concave or a convex trend over a limited range of the predictor.</p>
</section>
</section>
<section id="concaveconvex-curves-no-inflection-points" class="level1">
<h1>Concave/Convex curves (no inflection points)</h1>
<section id="exponential-function" class="level2">
<h2 class="anchored" data-anchor-id="exponential-function">Exponential function</h2>
<p>The most common parameterisation of an exponential function is:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20a%20e%5E%7Bk%20X%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(3)%20"></p>
<p>Depending on the sign of <img src="https://latex.codecogs.com/png.latex?k">, Eq. 3 describes a concave-up monotonically increasing shape (exponential growth; <img src="https://latex.codecogs.com/png.latex?k%20%3E%200">) or a concave-up monotonically decreasing shape (exponential decay; <img src="https://latex.codecogs.com/png.latex?k%20%3C%200">).</p>
<p>The parameter <img src="https://latex.codecogs.com/png.latex?a"> represents the value of <img src="https://latex.codecogs.com/png.latex?Y"> when <img src="https://latex.codecogs.com/png.latex?X%20=%200">, whereas the meaning of <img src="https://latex.codecogs.com/png.latex?k"> can be understood by considering the first derivative:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">D</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expression</span>(a <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">exp</span>(k <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> X)), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"X"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>a * (exp(k * X) * k)</code></pre>
</div>
</div>
<p>In algebraic terms, it is:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cfrac%7BdY%7D%7BdX%7D%20=%20k%20%5C,%20a%20%5C,%20e%5E%7Bk%20%5C,%20X%7D%20=%20k%20%5C,%20Y"></p>
<p>and thus:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cfrac%7BdY%7D%7BdX%7D%20%5Cfrac%7B1%7D%7BY%7D%20=%20k"></p>
<p>Therefore, <img src="https://latex.codecogs.com/png.latex?k"> represents the relative rate of change (increase/decrease), throughout the domain, which is often known in growth analysis as the Relative Growth Rate (RGR).</p>
<p>Other equivalent parameterisations are:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20e%5E%7Bd%20+%20k%20X%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(4)"></p>
<p>and:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20%20%5C,%20b%5EX%20%5Cquad%20%5Cquad%20%5Cquad%20(5)"></p>
<p>Equations 3-5 are equivalent, as can be shown by setting <img src="https://latex.codecogs.com/png.latex?b%20=%20e%5Ek"> and <img src="https://latex.codecogs.com/png.latex?a%20=%20e%5Ed">:</p>
<p><img src="https://latex.codecogs.com/png.latex?a%20%5C,%20b%5EX%20%20=%20e%20%5E%20d%20%20(e%5E%7BkX%7D%20)%20=%20%20a%20%20%5C,%20e%5E%7BkX%7D"></p>
<p>Another, slightly different, parameterisation is commonly used in bioassay studies, mainly to describe exponential decay processes:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20d%20%5Cexp(-x/e)%20%5Cquad%20%5Cquad%20%5Cquad%20(6)"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?d"> corresponds to <img src="https://latex.codecogs.com/png.latex?a"> in the previous models and <img src="https://latex.codecogs.com/png.latex?e%20=%20-%201/k">.</p>
<p>For all the exponential decay equations presented above, <img src="https://latex.codecogs.com/png.latex?Y%20%5Crightarrow%200"> as <img src="https://latex.codecogs.com/png.latex?X%20%5Crightarrow%20%5Cinfty">. A lower asymptote, <img src="https://latex.codecogs.com/png.latex?c%20%5Cneq%200">, can be incorporated into Eq. 6 to account for situations in which the response does not approach zero as the predictor tends to infinity:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20c%20+%20(d%20-c)%20%5Cexp(-x/e)%20%5Cquad%20%5Cquad%20%5Cquad%20(7)"></p>
<p>Exponential functions are often used to describe the growth of populations under non-limiting environmental conditions or the degradation of xenobiotics in the environment (first-order degradation kinetics). In both cases, <img src="https://latex.codecogs.com/png.latex?X"> represents time and is therefore restricted to non-negative values, while <img src="https://latex.codecogs.com/png.latex?b"> (or, equivalently, <img src="https://latex.codecogs.com/png.latex?k">) must be different from zero.</p>
</section>
<section id="asymptotic-function" class="level2">
<h2 class="anchored" data-anchor-id="asymptotic-function">Asymptotic function</h2>
<p>This function appears in several different parameterisations and is also known as the <em>monomolecular growth</em> function, the <em>Mitscherlich law</em>, or the <em>von Bertalanffy law</em>. Owing to its biological interpretation, the most widely used parameterisation is:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20-%20(a%20-%20b)%20%5C,%20%5Cexp%20(-%20m%20X)%20%5Cquad%20%5Cquad%20%5Cquad%20(8)"></p>
<p>It describes a monotonically increasing, concave-down curve approaching a horizontal asymptote as <img src="https://latex.codecogs.com/png.latex?X"> tends to infinity. The parameter <img src="https://latex.codecogs.com/png.latex?a"> represents the maximum attainable value of <img src="https://latex.codecogs.com/png.latex?Y"> (the plateau), while <img src="https://latex.codecogs.com/png.latex?b"> is the value of <img src="https://latex.codecogs.com/png.latex?Y"> when <img src="https://latex.codecogs.com/png.latex?X%20=%200"> (the initial value). The parameter <img src="https://latex.codecogs.com/png.latex?m"> is proportional to the rate at which the response approaches the plateau. Indeed, the first derivative is</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">D</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expression</span>(a <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> (a <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> b) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">exp</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> m <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> X)), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"X"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>(a - b) * (exp(-m * X) * m)</code></pre>
</div>
</div>
<p>Considering Eq.8, we can write:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cfrac%7BdY%7D%7BdX%7D%20=%20m%20%5C,%20(a%20-%20Y)"></p>
<p>and then:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cfrac%7BdY%7D%7BdX%7D%20%5Cfrac%7B1%7D%7BY%7D%20=%20m%20%5C,%20%5Cfrac%7B(a%20-%20Y)%7D%7BY%7D"></p>
<p>The previous expression shows that the relative rate of change in the response (the RGR in growth analysis) is not constant, as it is for the exponential function. Instead, it depends on the attained value of <img src="https://latex.codecogs.com/png.latex?Y">. In particular, the RGR is greatest at the beginning of the process, when <img src="https://latex.codecogs.com/png.latex?Y"> is smallest, and gradually approaches zero as <img src="https://latex.codecogs.com/png.latex?Y"> approaches the plateau <img src="https://latex.codecogs.com/png.latex?a">.</p>
<p>Another closely related parameterisation is often encountered, in which <img src="https://latex.codecogs.com/png.latex?a"> is replaced by <img src="https://latex.codecogs.com/png.latex?d">, <img src="https://latex.codecogs.com/png.latex?b"> by <img src="https://latex.codecogs.com/png.latex?c">, and <img src="https://latex.codecogs.com/png.latex?m"> by <img src="https://latex.codecogs.com/png.latex?e%20=%201/m">. Some simple algebraic manipulations are also introduced to make the model consistent with the parameterisation commonly adopted for biological assay models:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20(d%20-%20c)%20%5C,%20%5Cleft%5B1%20-%20%5Cexp%20%5Cleft(-%20%5Cfrac%7BX%7D%7Be%7D%20%5Cright)%20%5Cright%5D%20%5Cquad%20%5Cquad%20%5Cquad%20(9)"></p>
<p>In some applications, <img src="https://latex.codecogs.com/png.latex?m"> is reparameterised through its logarithm to facilitate model fitting:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20-%20(a%20-%20b)%20%5C,%20%5Cexp%20(-%20log(f)%20X)%20%5Cquad%20%5Cquad%20%5Cquad%20(10)"></p>
<p>For all these equations, setting <img src="https://latex.codecogs.com/png.latex?b%20=%200"> (or equivalently <img src="https://latex.codecogs.com/png.latex?c%20=%200">) yields a curve passing through the origin. In this case, the most common parameterisation is:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20%5Cleft%5B%201-%20%5Cexp%20(-%20m%20X)%20%5Cright%5D%20%5Cquad%20%5Cquad%20%5Cquad%20(11)"></p>
<p>which is known as the <em>negative exponential function</em>.</p>
<p>The asymptotic function is widely used in biology, not only for growth analysis but also, for example, in weed competition studies. The negative exponential function has also been used to model the absorbed Photosynthetically Active Radiation (<img src="https://latex.codecogs.com/png.latex?Y%20=%20PAR_a">) as a function of leaf area index (<img src="https://latex.codecogs.com/png.latex?X%20=%20LAI">). In this context, <img src="https://latex.codecogs.com/png.latex?a"> represents the incident PAR (<img src="https://latex.codecogs.com/png.latex?a%20=%20PAR_i">), while <img src="https://latex.codecogs.com/png.latex?m"> is the light extinction coefficient.</p>
</section>
<section id="power-function" class="level2">
<h2 class="anchored" data-anchor-id="power-function">Power function</h2>
<p>The power function is also known as <em>Freundlich function</em> or <em>allometric function</em>. The most common parameterisation is:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20a%20%5C,%20X%5Eb%20%5Cquad%20%5Cquad%20%5Cquad%20(12)"></p>
<p>Its shape is highly flexible and is determined by the value of the parameter <img src="https://latex.codecogs.com/png.latex?b"> (see Figure 1). When <img src="https://latex.codecogs.com/png.latex?0%20%3C%20b%20%3C%201">, the response <img src="https://latex.codecogs.com/png.latex?Y"> increases with <img src="https://latex.codecogs.com/png.latex?X"> and the curve is concave down. When <img src="https://latex.codecogs.com/png.latex?b%20%3C%200">, <img src="https://latex.codecogs.com/png.latex?Y"> decreases as <img src="https://latex.codecogs.com/png.latex?X"> increases and the curve is concave up. Finally, when <img src="https://latex.codecogs.com/png.latex?b%20%3E%201">, <img src="https://latex.codecogs.com/png.latex?Y"> increases with <img src="https://latex.codecogs.com/png.latex?X"> and the curve is concave up. These three cases are illustrated in Figure 1 using different colours. The function is defined only for <img src="https://latex.codecogs.com/png.latex?X%20%3E%200"> and has no horizontal asymptote as <img src="https://latex.codecogs.com/png.latex?X%20%5Crightarrow%20%5Cinfty">.</p>
<p>The biological interpretation of the parameters <img src="https://latex.codecogs.com/png.latex?a"> and <img src="https://latex.codecogs.com/png.latex?b"> is not straightforward. Both influence the slope of the curve, as can be seen by examining the first derivative:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">D</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expression</span>(a <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> X<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span>b), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"X"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>a * (X^(b - 1) * b)</code></pre>
</div>
</div>
<p>The power function is mathematically equivalent to an exponential function of <img src="https://latex.codecogs.com/png.latex?%5Clog(X)">, since:</p>
<p><img src="https://latex.codecogs.com/png.latex?a%20%5C,X%5Eb%20=%20a%20%5C,%20e%5E%7B%5Clog(%20X%5Eb%20)%7D%20=%20a%20%5C,%20e%5E%7Bb%20%5C,%20%5Clog(X)%7D"></p>
<p>The power function (named as the Freundlich equation) is widely used in agricultural chemistry, for example to model the sorption of xenobiotics in soil. It is also used to describe the relationship between the number of plant species and the sampled area (the species–area relationship).</p>
</section>
<section id="logarithmic-function" class="level2">
<h2 class="anchored" data-anchor-id="logarithmic-function">Logarithmic function</h2>
<p>This function is linear in <img src="https://latex.codecogs.com/png.latex?%5Clog(X)">:</p>
<p><img src="https://latex.codecogs.com/png.latex?y%20=%20a%20+%20b%20%5C,%20%5Clog(X)%20%5Cquad%20%5Cquad%20%5Cquad%20(13)"></p>
<p>Because of the logarithmic transformation, the function is only defined for <img src="https://latex.codecogs.com/png.latex?X%20%3E%200">. The parameter <img src="https://latex.codecogs.com/png.latex?b"> determines the shape of the curve. When <img src="https://latex.codecogs.com/png.latex?b%20%3E%200">, the response <img src="https://latex.codecogs.com/png.latex?Y"> increases with <img src="https://latex.codecogs.com/png.latex?X"> and the curve is concave down. Conversely, when <img src="https://latex.codecogs.com/png.latex?b%20%3C%200">, <img src="https://latex.codecogs.com/png.latex?Y"> decreases as <img src="https://latex.codecogs.com/png.latex?X"> increases and the curve is concave up, as shown in Figure 1.</p>
<p>The interpretation of the parameters is fairly straightforward. The parameter <img src="https://latex.codecogs.com/png.latex?a"> is the value of the response when <img src="https://latex.codecogs.com/png.latex?X%20=%201">. Changing <img src="https://latex.codecogs.com/png.latex?a"> while keeping <img src="https://latex.codecogs.com/png.latex?b"> constant simply shifts the curve vertically without altering its shape, so that the difference between any two curves remains constant for every value of <img src="https://latex.codecogs.com/png.latex?X"> (Fig. 2).</p>
<p>The parameter <img src="https://latex.codecogs.com/png.latex?b"> controls the slope of the curve and, more specifically, it is equal to the slope at <img src="https://latex.codecogs.com/png.latex?X%20=%201">, as can be seen from the expression for the first derivative:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">D</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expression</span>(a <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> b<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(X)), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"X"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>b * (1/X)</code></pre>
</div>
</div>
<p>Changing <img src="https://latex.codecogs.com/png.latex?b"> while keeping <img src="https://latex.codecogs.com/png.latex?a"> constant produces curves that all intersect at <img src="https://latex.codecogs.com/png.latex?X%20=%201"> (Fig. 2).</p>
<div class="cell">
<div class="cell-output-display">
<div id="fig-2" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://www.statforbiology.com/posts/nls_usefulEquations_files/figure-html/fig-2-1.png" class="img-fluid figure-img" style="width:75.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Effects of changing parameter values on the shape of logarithmic curves. The parameter <img src="https://latex.codecogs.com/png.latex?a"> is 1 for the red curves and 3 for the black curves, while <img src="https://latex.codecogs.com/png.latex?b"> is 1 for the solid lines (-1 on the right panel) and 0.5 for the dotted lines (-0.5 in the right panel)
</figcaption>
</figure>
</div>
</div>
</div>
<p>In biology, logarithmic functions are used, for example, to describe species–area relationships in ecology, enzyme kinetics in biochemistry, and sensory perception in neurobiology.</p>
</section>
<section id="rectangular-hyperbola" class="level2">
<h2 class="anchored" data-anchor-id="rectangular-hyperbola">Rectangular hyperbola</h2>
<p>The rectangular hyperbola is commonly known as the Michaelis-Menten function and is usually parameterised as</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20%5Cfrac%7Ba%20%5C,%20X%7D%20%7Bb%20+%20X%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(14)"></p>
<p>The curve is monotonically increasing and concave down, approaching the horizontal asymptote (plateau) <img src="https://latex.codecogs.com/png.latex?a">. It passes through the origin of the axes (<img src="https://latex.codecogs.com/png.latex?Y%20=%200"> when <img src="https://latex.codecogs.com/png.latex?X%20=%200">). The parameter <img src="https://latex.codecogs.com/png.latex?b"> is the value of <img src="https://latex.codecogs.com/png.latex?X"> that produces a response equal to <img src="https://latex.codecogs.com/png.latex?a/2">. Indeed,</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cfrac%7Ba%7D%7B2%7D%20=%20%5Cfrac%7Ba%20%5C,X_%7B50%7D%20%7D%20%7Bb%20+%20X_%7B50%7D%20%7D"></p>
<p>which is readily solved to obtain <img src="https://latex.codecogs.com/png.latex?X_%7B50%7D%20=%20b">.</p>
<p>The first derivative is:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">D</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">expression</span>( (a<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>X) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (b <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> X) ), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"X"</span>)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>a/(b + X) - (a * X)/(b + X)^2</code></pre>
</div>
</div>
<p>From this expression, we can see that the initial slope (at <img src="https://latex.codecogs.com/png.latex?X%20=%200">) is <img src="https://latex.codecogs.com/png.latex?i%20=%20a/b">.</p>
<p>Equation 14 is not defined for <img src="https://latex.codecogs.com/png.latex?X%20=%20-b"> and has no biological meaning for <img src="https://latex.codecogs.com/png.latex?X%20%3C%20-b">. In most biological applications, however, both <img src="https://latex.codecogs.com/png.latex?X"> and <img src="https://latex.codecogs.com/png.latex?b"> are positive.</p>
<p>An equivalent parameterisation is:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20%5Cfrac%7Ba%20%5C,%20X%7D%20%7Bb%20+%20X%7D%20=%20%5Cfrac%7Ba%7D%7B%20%5Cfrac%7Bb%7D%7BX%7D%20+%20%5Cfrac%7BX%7D%7BX%7D%7D%20=%20%5Cfrac%7Ba%7D%7B1%20+%20%5Cfrac%7Bb%7D%7BX%7D%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(15)"></p>
<p>In this form, the parameters <img src="https://latex.codecogs.com/png.latex?a"> and <img src="https://latex.codecogs.com/png.latex?b"> are often replaced by <img src="https://latex.codecogs.com/png.latex?d"> and <img src="https://latex.codecogs.com/png.latex?e">, respectively. Although the response is not defined for <img src="https://latex.codecogs.com/png.latex?X%20=%200">, it tends to zero as <img src="https://latex.codecogs.com/png.latex?X%20%5Crightarrow%200">.</p>
<p>Another common parameterisation includes the initial slope <img src="https://latex.codecogs.com/png.latex?i"> as an explicit parameter because of its biological relevance. This is obtained by dividing both the numerator and denominator by <img src="https://latex.codecogs.com/png.latex?b"> and noting that <img src="https://latex.codecogs.com/png.latex?i%20=%20a/b">, so that <img src="https://latex.codecogs.com/png.latex?b%20=%20a/i">:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20%5Cfrac%7Ba%20%5C,%20X%7D%20%7Bb%20+%20X%7D%20=%20%5Cfrac%7B%20%5Cfrac%7Ba%7D%7Bb%7D%20%5C,%20X%7D%20%7B%5Cfrac%7Bb%7D%7Bb%7D%20+%20%5Cfrac%7BX%7D%7Bb%7D%7D%20=%20%5Cfrac%7Bi%20%5C,%20X%7D%7B1%20+%20%5Cfrac%7Bi%20%5C,%20X%20%7D%7Ba%7D%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(16)"></p>
<p>The Michaelis-Menten function is widely used in pesticide chemistry, enzyme kinetics (Eq. 14), biological assay models (Eq. 15), and weed competition studies, where it is used to describe crop yield loss as a function of weed density (Eq. 16).</p>
</section>
</section>
<section id="sigmoidal-curves" class="level1">
<h1>Sigmoidal curves</h1>
<p>Sigmoidal curves are S-shaped and they may be increasing, decreasing, symmetric or non-symmetric around the inflection point. They are parameterised in countless ways, which may often be confusing. I will show some widespread parameterisations, that are very useful for bioassays or growth studies. All curves can be turned from increasing to decreasing (and vice-versa) by reversing the sign of the <img src="https://latex.codecogs.com/png.latex?b"> parameter.</p>
<section id="logistic-function" class="level2">
<h2 class="anchored" data-anchor-id="logistic-function">Logistic function</h2>
<p>The logistic curve is derived from the cumulative logistic distribution function. It is symmetric about its inflection point and can be parameterised as:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20%5Cfrac%7Bd%20-%20c%7D%7B1%20+%20exp(-%20b%20(X%20-%20e))%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(17)"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?d"> is the upper asymptote, <img src="https://latex.codecogs.com/png.latex?c"> is the lower asymptote, <img src="https://latex.codecogs.com/png.latex?e"> is the value of <img src="https://latex.codecogs.com/png.latex?X"> at the inflection point, and <img src="https://latex.codecogs.com/png.latex?b"> is proportional to the slope at the inflection point. Because the curve is symmetric, <img src="https://latex.codecogs.com/png.latex?e"> also represents the value of <img src="https://latex.codecogs.com/png.latex?X"> that produces a response halfway between <img src="https://latex.codecogs.com/png.latex?d"> and <img src="https://latex.codecogs.com/png.latex?c"> (commonly referred to as the ED50 in biological assays). The parameter <img src="https://latex.codecogs.com/png.latex?b"> may be either positive or negative and, consequently, the response may either increase or decrease as <img src="https://latex.codecogs.com/png.latex?X"> increases.</p>
<p>This equation is known as the four-parameter logistic model. If appropriate, constraints can be imposed on the parameter values. For example, <img src="https://latex.codecogs.com/png.latex?c"> may be fixed at 0, yielding the three-parameter logistic model. If, in addition, <img src="https://latex.codecogs.com/png.latex?d"> is fixed at 1, the model reduces to the two-parameter logistic model.</p>
</section>
<section id="gompertz-function" class="level2">
<h2 class="anchored" data-anchor-id="gompertz-function">Gompertz function</h2>
<p>The Gompertz curve can be parameterised in many different ways. I prefer a parameterisation that closely resembles that of the logistic function:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20(d%20-%20c)%20%5Cexp%20%5Cleft%5C%7B-%20%5Cexp%20%5Cleft%5B%20-%20b%20%5C,%20(X%20-%20e)%20%5Cright%5D%20%5Cright%5C%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(18)"></p>
<p>Unlike the logistic function, the Gompertz curve is not symmetric about its inflection point. It exhibits a longer lag phase at the beginning, followed by a progressively steeper increase before gradually approaching the upper asymptote. The parameters have essentially the same interpretation as those of the logistic function, except that <img src="https://latex.codecogs.com/png.latex?e">, the abscissa of the inflection point, does not correspond to the value of <img src="https://latex.codecogs.com/png.latex?X"> producing a response halfway between <img src="https://latex.codecogs.com/png.latex?c"> and <img src="https://latex.codecogs.com/png.latex?d">.</p>
<p>As with the logistic function, four-, three-, and two-parameter Gompertz models can be obtained by constraining one or both asymptotes. These models are widely used to describe plant growth and many other biological processes.</p>
</section>
<section id="modified-gompertz-function" class="level2">
<h2 class="anchored" data-anchor-id="modified-gompertz-function">Modified Gompertz function</h2>
<p>We have seen that the logistic curve is symmetric about its inflection point, whereas the Gompertz curve exhibits a longer lag phase at the beginning, followed by a progressively steeper increase. A different asymmetric pattern can be obtained by modifying the Gompertz function as follows:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20c%20+%20(d%20-%20c)%20%5Cleft%5C%7B%201%20-%20%5Cexp%20%5Cleft%5C%7B-%20%5Cexp%20%5Cleft%5B%20b%20%5C,%20(X%20-%20e)%20%5Cright%5D%20%5Cright%5C%7D%20%5Cright%5C%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(19)"></p>
<p>The resulting curve increases rapidly at the beginning but gradually slows down as it approaches the upper asymptote. As with the logistic and Gompertz functions, one or both asymptotes can be constrained (<img src="https://latex.codecogs.com/png.latex?d%20=%201"> and/or <img src="https://latex.codecogs.com/png.latex?c%20=%200">), giving rise to four-, three-, and two-parameter versions of the modified Gompertz model.</p>
</section>
<section id="log-logistic-function" class="level2">
<h2 class="anchored" data-anchor-id="log-logistic-function">Log-logistic function</h2>
<p>The log-logistic curve is symmetric with respect to <img src="https://latex.codecogs.com/png.latex?%5Clog(X)">. A log-normal curve has a very similar shape, although it is used much less frequently. In biological assays (and also in germination studies), the log-logistic function is commonly parameterised as</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20%5Cfrac%7Bd%20-%20c%7D%7B1%20+%20%5Cexp%20%5Cleft%5C%7B%20-%20b%20%5Cleft%5B%20%5Clog(X)%20-%20%5Clog(e)%20%5Cright%5D%20%5Cright%5C%7D%20%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(20)"></p>
<p>The parameters have the same interpretation as in the logistic function. In particular, <img src="https://latex.codecogs.com/png.latex?e"> represents the value of <img src="https://latex.codecogs.com/png.latex?X"> that produces a response halfway between <img src="https://latex.codecogs.com/png.latex?c"> and <img src="https://latex.codecogs.com/png.latex?d"> (the ED50). It is easy to show that the above equation is equivalent to</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20%5Cfrac%7Bd%20-%20c%7D%7B1%20+%20%5Cleft(%20%5Cfrac%7BX%7D%7Be%7D%20%5Cright)%5E%7B-b%7D%7D%5Cquad%20%5Cquad%20%5Cquad%20(21)"></p>
<p>Like the logistic function, the log-logistic model can be fitted in four-, three-, or two-parameter versions by constraining one or both asymptotes. It is widely used to describe dose-response relationships in biological assays, seed germination, and crop growth.</p>
</section>
<section id="weibull-function-type-1" class="level2">
<h2 class="anchored" data-anchor-id="weibull-function-type-1">Weibull function (type 1)</h2>
<p>The Type I Weibull function is the logarithmic counterpart of the Gompertz function, being defined on <img src="https://latex.codecogs.com/png.latex?%5Clog(X)"> rather than on <img src="https://latex.codecogs.com/png.latex?X">. It is parameterised as</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20c%20+%20(d%20-%20c)%20%5Cexp%20%5Cleft%5C%7B-%20%5Cexp%20%5Cleft%5B%20-%20b%20%5C,%20(%5Clog(X)%20-%20%5Clog(e))%20%5Cright%5D%20%5Cright%5C%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(22)"></p>
<p>The parameters have essentially the same interpretation as those of the other sigmoidal functions presented above. In particular, <img src="https://latex.codecogs.com/png.latex?c"> and <img src="https://latex.codecogs.com/png.latex?d"> are the lower and upper asymptotes, respectively, while <img src="https://latex.codecogs.com/png.latex?e"> is the value of <img src="https://latex.codecogs.com/png.latex?X"> corresponding to the inflection point. Unlike the log-logistic function, however, <img src="https://latex.codecogs.com/png.latex?e"> does not correspond to the ED50.</p>
</section>
<section id="weibull-function-type-2" class="level2">
<h2 class="anchored" data-anchor-id="weibull-function-type-2">Weibull function (type 2)</h2>
<p>The Type II Weibull function is closely related to the Type I Weibull function, but it describes a different type of asymmetry, analogous to that of the modified Gompertz function:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20c%20+%20(d%20-%20c)%20%5Cleft%5C%7B%201%20-%20%5Cexp%20%5Cleft%5C%7B-%20%5Cexp%20%5Cleft%5B%20b%20%5C,%20(%5Clog(X)%20-%20%5Clog(e))%20%5Cright%5D%20%5Cright%5C%7D%20%5Cright%5C%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(23)"></p>
<p>The parameters have the same interpretation as those of the Type I Weibull function. In particular, <img src="https://latex.codecogs.com/png.latex?c"> and <img src="https://latex.codecogs.com/png.latex?d"> are the lower and upper asymptotes, respectively, while <img src="https://latex.codecogs.com/png.latex?e"> is the value of <img src="https://latex.codecogs.com/png.latex?X"> at the inflection point. As with the Type I Weibull function, <img src="https://latex.codecogs.com/png.latex?e"> does not correspond to the ED50. One or both asymptotes may be constrained, giving rise to four-, three-, and two-parameter versions of the model.</p>
</section>
</section>
<section id="curves-with-maximaminima" class="level1">
<h1>Curves with maxima/minima</h1>
<p>It is sometimes necessary to describe phenomena where the <img src="https://latex.codecogs.com/png.latex?Y"> variable reaches a maximum value at a certain level of the <img src="https://latex.codecogs.com/png.latex?X"> variable, and drops afterwords. For example, growth or germination rates are higher at optimal temperature levels and lower at supra-optimal or sub-optimal temperature levels. Another example relates to bioassays: in some cases, low doses of toxic substances induce a stimulation of growth (hormesis), which needs to be described by an appropriate model. The second order (and higher order) polynomial funcion we have seen earlier is capable of accounting for maxima/minima, but there are a few other interesting functions that may turn out useful in some circumstances.</p>
<section id="bragg-function" class="level2">
<h2 class="anchored" data-anchor-id="bragg-function">Bragg function</h2>
<p>This function is connected to the normal (Gaussian) distribution and has a symmetric shape with a maximum equal to <img src="https://latex.codecogs.com/png.latex?d">, that is reached when <img src="https://latex.codecogs.com/png.latex?X%20=%20e"> and two inflection points. In this model, <img src="https://latex.codecogs.com/png.latex?b"> relates to the slope at the inflection points; the response <img src="https://latex.codecogs.com/png.latex?Y"> approaches 0 when <img src="https://latex.codecogs.com/png.latex?X"> approaches <img src="https://latex.codecogs.com/png.latex?%5Cpm%20%5Cinfty">:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20d%20%5C,%20%5Cexp%20%5Cleft%5B%20-%20b%20(X%20-%20e)%5E2%20%5Cright%5D%20%5Cquad%20%5Cquad%20%5Cquad%20(24)"></p>
<p>If we would like to have lower asymptotes different from 0, we should add the parameter <img src="https://latex.codecogs.com/png.latex?c">, as follows:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20(d%20-%20c)%20%5C,%20%5Cexp%20%5Cleft%5B%20-%20b%20(X%20-%20e)%5E2%20%5Cright%5D%20%5Cquad%20%5Cquad%20%5Cquad%20(25)"></p>
<p>The two Bragg functions have proven useful in applications relating to the science of carbon materials.</p>
</section>
<section id="lorentz-function" class="level2">
<h2 class="anchored" data-anchor-id="lorentz-function">Lorentz function</h2>
<p>The Lorentz function is similar to the Bragg function, although it has worse statistical properties (Ratkowsky, 1990). The equation is:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20%5Cfrac%7Bd%7D%20%7B%201%20+%20b%20(X%20-%20e)%5E2%20%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(26)"></p>
<p>We can also allow for lower asymptotes different from 0, by adding a further parameter:</p>
<p><img src="https://latex.codecogs.com/png.latex?Y%20=%20c%20+%20%5Cfrac%7Bd%20-%20c%7D%20%7B%201%20+%20b%20(X%20-%20e)%5E2%20%7D%20%5Cquad%20%5Cquad%20%5Cquad%20(27)"></p>
</section>
<section id="beta-function" class="level2">
<h2 class="anchored" data-anchor-id="beta-function">Beta function</h2>
<p>The beta function derives from the beta density function and it has been adapted to describe phenomena taking place only within a minimum and a maximum threshold value (threshold model). One typical example is seed germination, where the germination rate (GR, i.e.&nbsp;the inverse of germination time) is 0 below the base temperature level and above the cutoff temperature level. Between these two extremes, the GR increases with temperature up to a maximum level, that is reached at the optimal temperature level.</p>
<p>The equation is:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20Y%20=%20d%20%5C,%5Cleft%5C%7B%20%20%5Cleft(%20%5Cfrac%7BX%20-%20X_b%7D%7BX_o%20-%20X_b%7D%20%5Cright)%20%5Cleft(%20%5Cfrac%7BX_c%20-%20X%7D%7BX_c%20-%20X_o%7D%20%5Cright)%20%5E%20%7B%5Cfrac%7BX_c%20-%20X_o%7D%7BX_o%20-%20X_b%7D%7D%20%5Cright%5C%7D%5Eb%20%5Cquad%20%5Cquad%20%5Cquad%20(28)"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?d"> is the maximum level for the expected response <img src="https://latex.codecogs.com/png.latex?Y">, <img src="https://latex.codecogs.com/png.latex?X_b"> and <img src="https://latex.codecogs.com/png.latex?X_c"> are, respectively, the minumum and maximum threshold levels, <img src="https://latex.codecogs.com/png.latex?X_o"> is the abscissa at the maximum expected response level and <img src="https://latex.codecogs.com/png.latex?b"> is a shape parameter. The above function is only defined for <img src="https://latex.codecogs.com/png.latex?X_b%20%3C%20X%20%3C%20X_c"> and it returns 0 elsewhere.</p>
</section>
</section>
<section id="conclusions" class="level1">
<h1>Conclusions</h1>
<p>Here we are; I have discussed more almost 30 functions, which are commonly used to model biological processes. These functions can be found in several different parameterisations and flavours; they can also be modified and combined to suit the needs of several disciplines in biology, chemistry and so on. However, this will require another post.</p>
<p>Thanks for reading! And … don’t forget to check out my new book!</p>
<p>Prof.&nbsp;Andrea Onofri<br>
Department of Agricultural, Food and Environmental Sciences<br>
University of Perugia (Italy)<br>
Send comments to: <a href="mailto:andrea.onofri@unipg.it">andrea.onofri@unipg.it</a></p>
<p><a href="https://www.awin1.com/cread.php?awinmid=26429&amp;awinaffid=2675822&amp;ued=https%3A%2F%2Flink.springer.com%2Fbook%2F10.1007%2F978-3-032-08199-5"><img src="https://www.statforbiology.com/Figures/Email_Signature_978-3-032-08199-5.png" alt="Book cover" class="cover" align="center"></a></p>
<hr>
</section>
<section id="further-readings" class="level1">
<h1>Further readings</h1>
<ol type="1">
<li>Miguez, F., Archontoulis, S., Dokoohaki, H., Glaz, B., Yeater, K.M., 2018. Chapter 15: Nonlinear Regression Models and Applications, in: ACSESS Publications. American Society of Agronomy, Crop Science Society of America, and Soil Science Society of America, Inc.</li>
<li>Ratkowsky, D.A., 1990. Handbook of nonlinear regression models. Marcel Dekker Inc., New York, USA.</li>
<li>Ritz, C., Jensen, S. M., Gerhard, D., Streibig, J. C. (2019) Dose-Response Analysis Using R. CRC Press</li>
</ol>


</section>

 ]]></description>
  <category>nonlinear regression</category>
  <guid>https://www.statforbiology.com/posts/nls_usefulEquations.html</guid>
  <pubDate>Mon, 07 Jan 2019 23:00:00 GMT</pubDate>
</item>
<item>
  <title>My learning path with blogdown</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/R_BlogdownSteps.html</link>
  <description><![CDATA[ 





<p>This is my first day at work with blogdown. I must admit it is pretty overwhelming at the beginning …</p>
<p>I worked with R Studio and installed the library ‘blogdown’. I followed the instructions and used the ‘NEW PROJECT’ menu and added a ‘NEW BLOGDOWN SITE’ to my file system. I selected the ‘hugo-blog-jeffprod’ theme. This created a bunch of directories in my working directory.</p>
<p>[NOTE: 29/3/2026. I have discovered that it is more convenient to create a folder in my hard-disk and create a new RStudio project in that existing folder.]</p>
<p>If I use the ‘serve_site()’ function in console, the Hugo server is called and the site is continuously updated, as soon as I make changes and save them. When the server is started, a message appears, saying: “Serving the directory PROJECTDIR at http://127.0.0.1:7958”. I copied the http address on Safari (I am working on Mac OS…), so that I can check my changes there.</p>
<p>Here are my steps to the learning the process.</p>
<section id="step-1---the-mathjax-problem" class="level1">
<h1>Step 1 - The MathJax problem</h1>
<p>I added a post to the ‘content’ directory. This was a trial post, with an equation in latex code. I immediately noted that there was no support to MathJax. Surfing the net, I found a solution for this. These were my steps:</p>
<ol type="1">
<li><p>The folder ‘themes/hugo-blog-jeffprod/layouts/partials’ contains the template file ‘header.html’. The blogdown documentation suggests not to directly modify this file. Thus I created a copy on the ‘layouts/partials/’ folder in my root directory. This folder did not exist at the beginning, so I created it.</p></li>
<li><p>I opened the newly created file ‘layouts/partials/header.html’ and added the following lines within the</p>

<p>…</p>

<p>section:</p></li>
</ol>
<pre><code>&lt;script type="text/javascript"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;
&lt;/script&gt;</code></pre>
<p>Equations seem to render ok, now.</p>
</section>
<section id="step-2---change-the-blog-name-and-author" class="level1">
<h1>Step 2 - Change the blog name and author</h1>
<p>I modified the ‘config.toml’ file in the root directory and added name and author of the site. An easy step…</p>
</section>
<section id="step-3---clean-the-example-files" class="level1">
<h1>Step 3 - Clean the example files</h1>
<p>There were a lot of example posts in the ‘content’ directory. I removed them all, with no problems. I also had to remove the content of the ‘static’ folder. These files were not needed, because they belonged to the example posts.</p>
</section>
<section id="step-4---where-do-i-put-my-post" class="level1">
<h1>Step 4 - Where do I put my post?</h1>
<p>New posts need to be put in the ‘content/post’ directory. In order to add a post, I am using the function ‘blogdown::new_post_addin()’ (I like working in console…), which creates a correct skeleton. Blog posts are listed under the home page of my blog, sorted by date and by tags.</p>
</section>
<section id="step-5---where-do-i-put-my-non-post-pages" class="level1">
<h1>Step 5 - Where do I put my non-post pages?</h1>
<p>I did not intend to create a pure blog. I wanted also to add static pages, such as articles, tutorials, a project page, links and other stuff. I noted that, when .md or .Rmd files are left in the ‘content’ folder, a folder with the same name is created in ‘public’ and the post is rendered within that folder. Therefore, I put a ‘links.md’ file in the ‘content’ folder, containing a few links to other web pages of interest. This file is not rendered as a post and it is not visible in my home page. However, a folder named ‘link’ is created in the public directory, containing the ‘links.md’ file, rendered as ‘index.html’ file. Therefore, I can link this file by using the ‘/link/’ address.</p>
</section>
<section id="step-6---how-do-i-create-further-entries-for-the-navigation-bar" class="level1">
<h1>Step 6 - How do I create further entries for the navigation bar?</h1>
<p>I just created the ‘/link/index.html’ file in the ‘public’ directory. I would like the reader to access this web page by clicking on an appropriate link at the top of the home-page, next to the ‘Home’ and ‘About me’ links. In order to add this link, I had to edit again the ‘layouts/partials/header.html’ file. In the ‘nav’ section, there was the line:</p>
<pre><code>&lt;a class="navbar-item" href="{{ "about" | absURL }}"&gt;About me&lt;/a&gt;</code></pre>
<p>This line creates the ‘About me’ link on the navigation bar. Below this line, I added another line:</p>
<pre><code>&lt;a class="navbar-item" href="{{ "links" | absURL }}"&gt;Links&lt;/a&gt;</code></pre>
<p>I guess I can use this approach to redirect readers to other web pages of interest.</p>
</section>
<section id="step-7---i-need-to-put-some-order-in-the-content-folder-412019" class="level1">
<h1>Step 7 - I need to put some order in the ‘content’ folder’ (4/1/2019)!</h1>
<p>After adding a few non-post pages to my content folder I wanted to avoid too much confusion. I discovered that I can add folders to the ‘content’ folder. They are rendered as such in the public directory. For example, I created an ‘article’ folder and put a ‘page1.md’ file inside it. After rendering, a folder ‘article/page1/’ is created in the ‘public’ folder, containing the ‘index.html’ page, which is the rendered version of the ‘page1.md’ file.</p>
<p>I think I start feeling slightly more confident with blogdown!</p>
</section>
<section id="step-8---literature-support-712019" class="level1">
<h1>Step 8 - Literature support (7/1/2019)!</h1>
<p>This problem took me a while to solve. Lately, I discovered that, in order to be able to insert citations, the post file needs to be ‘.Rmd’ and not ‘.md.’ Furthermore, the literature file (‘.bib’) and the ‘.csl’ file need to be in the ‘/content/’ folder. A reference to both files need to be put in the YAML header, e.g., :</p>
<pre><code>bibliography: myFile.bib
csl: myStyle.csl</code></pre>
</section>
<section id="step-9---google-analytics-622019" class="level1">
<h1>Step 9 - Google Analytics (6/2/2019)</h1>
<p>I would like to track the visits I receive. To do so I enabled Google Analytics and got my tracking id (<a href="https://support.google.com/analytics/answer/1008080">see here</a>). I also worked on my ‘config.toml’ file and added the following statement.</p>
<pre><code>GoogleAnalytics = "UA-my_ID"</code></pre>
<p>In contrast to what I expected, Google Analytics did not work and no hits were recorded for my blog. Lately, I worked on the ‘layouts/partials/header.html’ and added the following code, right after the ’</p>

<p>’ tag (just replaced ‘UA-my_ID’ with my tracking id).</p>
<pre><code>&lt;!-- Global Site Tag (gtag.js) - Google Analytics --&gt;
&lt;script async src="https://www.googletagmanager.com/gtag/js?id=UA-my_ID"&gt;&lt;/script&gt;
&lt;script&gt;
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-my_ID');
&lt;/script&gt;</code></pre>
<p>Now Google Analytics works ok!</p>
</section>
<section id="step-10---add-an-rss-template" class="level1">
<h1>Step 10 - Add an RSS Template</h1>
<p>I wanted my RSS feed to contain the whole post and not only a description. I did the following:</p>
<ol type="1">
<li>Took the default template from <a href="https://gohugo.io/templates/rss/#the-embedded-rss-xml">this site</a>.</li>
<li>Replaced ‘{{ .Summary | html }}’ with ‘{{ .Content | html }}’</li>
<li>Saved the file as ‘RSS.xml’under the ’layouts’ directory.</li>
</ol>
</section>
<section id="step-11---further-info-on-google-analytics-10122020" class="level1">
<h1>Step 11 - Further info on Google Analytics (10/12/2020)</h1>
<p>A very kind reader (Emma) emailed me that there have been some relevant updates for Google analytics (v4). She pointed me to the following guide: <a href="https://www.websiteplanet.com/blog/ultimate-beginners-guide-google-analytics/" class="uri">https://www.websiteplanet.com/blog/ultimate-beginners-guide-google-analytics/</a>. This is useful, to have a better comprehension of the whole Google Analytics platform, just in case someone is interested.</p>
</section>
<section id="step-12---adding-an-image-to-a-blog-post-19102021" class="level1">
<h1>Step 12 - Adding an image to a blog post (19/10/2021)</h1>
<p>It took me awhile to figure out how to include a figure in a blog post. Lately I also discovered that there is a blogdown add-in to help with this job (<a href="https://lcolladotor.github.io/2018/03/07/blogdown-insert-image-addin/#.YW8HJC8RpTY">see this post here</a>), but I wanted to master the whole process. I solved the problem like this:</p>
<ol type="1">
<li>created an ‘img’ folder within the ‘static’ folder in my blogdown project directory.</li>
<li>Put all the images I wanted to include in blog posts in that folder</li>
<li>Use the markdown code:</li>
</ol>
<pre><code>![caption](/img/figFileName.png)</code></pre>
<p>Be careful: the ‘slash’ character at the beginning of file path is fundamental, otherwise the code does not work. Of course, you can use html tags to center your figure:</p>
<pre><code>&lt;p style="text-align:center"&gt;
![](/_Figures/Stat_drcte_3-method-data.png){width=90%}
&lt;/p&gt;</code></pre>
</section>
<section id="step-13---changing-the-title-of-the-home-page-14122023" class="level1">
<h1>Step 13 - Changing the title of the home page (14/12/2023)</h1>
<p>It may seem stupid, but it took me awhile to figure out how I could possibly change the title for the homepage. Lately, in the cointent folder I discovered a file named ‘_index.Rmarkdown’, containing only the YAML header with</p>
<pre><code>---
title: Homepage title
---</code></pre>
<p>This is where the homepage title is defined. As far as I could see, all other test in the body of this file is neglected.</p>


</section>

 ]]></description>
  <category>General</category>
  <guid>https://www.statforbiology.com/posts/R_BlogdownSteps.html</guid>
  <pubDate>Wed, 14 Nov 2018 23:00:00 GMT</pubDate>
</item>
<item>
  <title>The Variance Puzzle: Why Doesn’t R Divide by ‘n’?</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/Stat_General_VarianceSamplePop.html</link>
  <description><![CDATA[ 





<p>Teaching Experimental Methodology in master’s courses related to agriculture poses some peculiar challenges. One of them is explaining the difference between <strong>population variance</strong> and <strong>sample variance</strong>.</p>
<p>Students usually have little difficulty understanding that, since the mean represents the “centre” of a dataset, it is natural to measure the average squared distance of all observations from the mean. Of course, we square the distances because, otherwise, positive and negative deviations would cancel each other out.</p>
<p>It therefore seems perfectly reasonable that the average squared distance (the <strong>variance</strong>) should be calculated as</p>
<p><img src="https://latex.codecogs.com/png.latex?%7B%5Csigma%20%5E2%7D%20=%20%5Cfrac%7B%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(%7BX_i%7D%20-%20%5Cmu%20)%5E2%7D%7Bn%7D"></p>
<p>However, this is <strong>not</strong> what R (or most other statistical software) does. Instead, R divides by <img src="https://latex.codecogs.com/png.latex?n-1">, and at this point students inevitably ask:</p>
<div class="callout callout-style-default callout-important callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Important
</div>
</div>
<div class="callout-body-container callout-body">
<p>“Why are you telling me to divide the sum of squares by <img src="https://latex.codecogs.com/png.latex?n-1"> instead of <img src="https://latex.codecogs.com/png.latex?n">? I have <img src="https://latex.codecogs.com/png.latex?n"> squared residuals, not <img src="https://latex.codecogs.com/png.latex?n-1">!”</p>
</div>
</div>
<p>You might think that the answer is obvious. I do not.</p>
<p>At this stage of the course, variance is introduced within the context of descriptive statistics. The students know nothing yet about probability distributions, sampling, statistical inference, or degrees of freedom. If I were teaching mathematics or statistics, I could impress the class with a formal proof showing that <img src="https://latex.codecogs.com/png.latex?n-1"> is the correct denominator whenever a sample is used to estimate the population variance. That proof can be found in virtually every statistics textbook, and I have reproduced it at the end of this post.</p>
<p>However, I would never present that proof at this point. It assumes concepts that the students have not yet encountered, such as sampling distributions and standard errors. Moreover, agricultural students are generally not enthusiastic when mathematics becomes too abstract!</p>
<p>Instead of trying to appear clever, I usually ask myself a different question:</p>
<div class="callout callout-style-default callout-important callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Important
</div>
</div>
<div class="callout-body-container callout-body">
<p>Can we explain the difference between population variance and sample variance without mentioning degrees of freedom or any other difficult concepts?</p>
</div>
</div>
<p>Here is the approach I usually take.</p>
<p>Let’s consider a large but finite population—for example, one hectare of maize, containing roughly 70,000 plants. Imagine that we know the yield of every single plant. In R we can simulate such a population by generating random values between 150 and 250 g. (Agricultural students immediately recognise these as realistic values, and at this stage I deliberately avoid discussing probability distributions.)</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">set.seed</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1234</span>)</span>
<span id="cb1-2">pop <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">runif</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">70000</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">min =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">max =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">250</span>)</span></code></pre></div></div>
</div>
<p>We now have our finite population. Since we know every individual, we can calculate both the population mean and the population variance—that is, the average squared distance of all 70,000 observations from their mean. Notice that I use the equation above, with <img src="https://latex.codecogs.com/png.latex?n"> in the denominator.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(pop) </span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 200.0893</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">sigma2 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>( ( pop <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(pop) )<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> )<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">70000</span></span>
<span id="cb4-2">sigma2</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 835.184</code></pre>
</div>
</div>
<p>Now let’s forget about the population. In practice, we would never measure the yield of every plant in a hectare because of limitations in time and resources. Instead, suppose we randomly select just ten plants (agricultural experiments often involve surprisingly small sample sizes!).</p>
<p>We can obtain such a sample in R by drawing observations from the original population.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">x <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sample</span>(pop, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>)</span>
<span id="cb6-2">x</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] 174.0269 239.5843 209.6669 222.3267 160.7107 229.6837 238.1470 202.0382
 [9] 249.2965 170.6348</code></pre>
</div>
</div>
<p>Using the same formula as before (that is, dividing by <img src="https://latex.codecogs.com/png.latex?n=10">), we calculate the sample mean and sample variance.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(x) </span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 209.6116</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1">sigma2_s <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>( ( x <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(x) )<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> )<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span> </span>
<span id="cb10-2">sigma2_s</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 908.6202</code></pre>
</div>
</div>
<p>We do not know the population, only the sample. In the absence of any other information, the most reasonable assumption is that the population resembles the sample. The procedure used to obtain this guess is called an <strong>estimator</strong>, while the resulting value is an <strong>estimate</strong>.</p>
<p>But is it a good estimator?</p>
<p>We cannot tell from a single sample. Instead, we need to repeat the sampling process many times and examine how the estimates behave in the long run. An estimator is considered good if, on average, it converges to the true population value.</p>
<p>Let’s repeat the sampling procedure 10,000 times, each time selecting ten plants and calculating both the sample mean and the sample variance.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1">meanS <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>();</span>
<span id="cb12-2">varS <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>() </span>
<span id="cb12-3"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span>(i <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10000</span>){   </span>
<span id="cb12-4">  x <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sample</span>(pop, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>)   </span>
<span id="cb12-5">  meanS[i] <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(x)   </span>
<span id="cb12-6">  varS[i] <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>( ( x <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(x) )<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> )<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span> </span>
<span id="cb12-7">  }</span>
<span id="cb12-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(meanS)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 199.9096</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(varS)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 752.4658</code></pre>
</div>
</div>
<p>The average of the 10,000 sample means is 199.91, which is extremely close to the true population mean. Therefore, the sample mean is an <strong>unbiased estimator</strong> of the population mean.</p>
<p>The average of the 10,000 sample variances, however, is 752.47, which is noticeably smaller than the true population variance. In other words, if we divide by <img src="https://latex.codecogs.com/png.latex?n">, we systematically underestimate the population variance.</p>
<p>Let’s examine the ratio between the true population variance and the average estimated variance:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb16" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">var</span>(pop)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(varS)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 1.109945</code></pre>
</div>
</div>
<p>The result is approximately <img src="https://latex.codecogs.com/png.latex?10/9">.</p>
<p>Therefore, if we</p>
<ol type="1">
<li>calculate the sample variance by dividing by <img src="https://latex.codecogs.com/png.latex?n">,</li>
<li>multiply by <img src="https://latex.codecogs.com/png.latex?n">, and</li>
<li>divide by <img src="https://latex.codecogs.com/png.latex?n-1">,</li>
</ol>
<p>we obtain an estimator that is correct on average.</p>
<p>This leads to the familiar formula</p>
<p><img src="https://latex.codecogs.com/png.latex?%7B%5Csigma%20%5E2%7D%20=%20%5Cfrac%7B%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(%7BX_i%7D%20-%20m%20)%5E2%7D%7Bn%20-%201%7D"></p>
<p>which is exactly the sample variance calculated by R.</p>
<section id="which-formula-should-we-use" class="level1">
<h1>Which formula should we use?</h1>
<p>The answer is easy to remember.</p>
<ol type="1">
<li>If we know the entire population, the variance is the average squared deviation from the population mean, so we divide by <img src="https://latex.codecogs.com/png.latex?n">.</li>
<li>If we only have a random sample and our goal is to estimate the population variance, we divide by <img src="https://latex.codecogs.com/png.latex?n-1">. Otherwise, our estimate will be systematically too small.</li>
</ol>
<p>Thanks for reading! And … don’t forget to check out my new book!</p>
<p>Prof.&nbsp;Andrea Onofri<br>
Department of Agricultural, Food and Environmental Sciences<br>
University of Perugia (Italy)<br>
Send comments to: <a href="mailto:andrea.onofri@unipg.it">andrea.onofri@unipg.it</a></p>
<p><a href="https://www.awin1.com/cread.php?awinmid=26429&amp;awinaffid=2675822&amp;ued=https%3A%2F%2Flink.springer.com%2Fbook%2F10.1007%2F978-3-032-08199-5"><img src="https://www.statforbiology.com/Figures/Email_Signature_978-3-032-08199-5.png" alt="Book cover" class="cover" align="center"></a></p>
<hr>
</section>
<section id="the-formal-proof-look-how-clever-i-am" class="level1">
<h1>The formal proof (look how clever I am!)</h1>
<p>We have a population with mean equal to <img src="https://latex.codecogs.com/png.latex?%5Cmu"> and variance equal to <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2">. Let’s take a sample with its mean <img src="https://latex.codecogs.com/png.latex?m%20%5Cneq%20%5Cmu"> and <img src="https://latex.codecogs.com/png.latex?m%20-%20%5Cmu%20=%20%5Cvarepsilon">. For the population, we can write:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(X_i%20-%20%5Cmu%20)%5E2%20%20=%20%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(X_%20i%20-%20m%20+%20%5Cvarepsilon)%5E2%20=%20%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(%7BX_i%7D%20-%20m)%5E2%20+%20n%20%5Cvarepsilon%5E2"></p>
<p>We already see that the sum of squared residuals is higher if we take <img src="https://latex.codecogs.com/png.latex?m"> instead of <img src="https://latex.codecogs.com/png.latex?%5Cmu">, unless <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon%20=%200">, i.e.&nbsp;<img src="https://latex.codecogs.com/png.latex?m%20=%20%5Cmu">. From the above, we derive</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(X_i%20-%20%5Cmu)%5E2%20=%20%20%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(X_i%20-%20%5Cmu%20)%5E2%20%20-%20n%20(%20%7Bm%20-%20%5Cmu%20%7D%20)%5E2"></p>
<p>If we consider the first equation above (variance for the population) we have</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(X_i%20-%20%5Cmu)%5E2%20=%20%20n%20%5Csigma%5E2%20-%20n(%20m%20-%20%5Cmu%20%20)%5E2"></p>
<p>We see that the rightmost term of this equation (<img src="https://latex.codecogs.com/png.latex?n%20(%20m%20-%20%5Cmu%20%20)%5E2"> is the sum of squared distances for the sampling distribution of the mean. That is <img src="https://latex.codecogs.com/png.latex?n"> times the squared standard error. Therefore:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Csum%5Climits_%7Bi%20=%201%7D%5En%20%7B%7B%7B(%7BX_i%7D%20-%20%5Cbar%20X)%7D%5E2%7D%20=%20%7D%20n%7B%5Csigma%20%5E2%7D%20-%20n%5Cleft(%20%7B%5Cfrac%7B%7B%7B%5Csigma%20%5E2%7D%7D%7D%7Bn%7D%7D%20%5Cright)"></p>
<p>and</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Csum%5Climits_%7Bi%20=%201%7D%5En%20%7B%7B%7B(%7BX_i%7D%20-%20%5Cbar%20X)%7D%5E2%7D%20=%20%7D%20(n%20-%201)%7B%5Csigma%20%5E2%7D"></p>
<p>Here we go! Indeed:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cfrac%7B%5Csum%5Climits_%7Bi%20=%201%7D%5En%20(X_i%20-%20m)%5E2%20%7D%7Bn%20-%201%7D%20=%20%7B%5Csigma%20%5E2%7D"></p>


</section>

 ]]></description>
  <category>descriptive statistics</category>
  <guid>https://www.statforbiology.com/posts/Stat_General_VarianceSamplePop.html</guid>
  <pubDate>Thu, 08 Nov 2018 23:00:00 GMT</pubDate>
  <media:content url="https://www.statforbiology.com/Figures/VarianceSamplePop.jpg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Is R dangerous? Side effects of free software for biologists</title>
  <dc:creator>Andrea Onofri</dc:creator>
  <link>https://www.statforbiology.com/posts/R_TheDangerOfR.html</link>
  <description><![CDATA[ 





<p>When I started my career in biology (almost forty years ago), only the luckiest of us had access to advanced statistical software. Licences were very expensive, and it was not easy to convince the boss that they were really necessary: <em>“Why do you need to spend so much money just to perform an ANOVA?”</em> In fact, simple one- or two-way ANOVAs were not difficult to carry out, and one of my colleagues had already written the appropriate routines for several experimental designs using GW-BASIC. But I wanted more!</p>
<p>My agricultural experiments often involved complex designs. Split-plot, strip-plot, subsampling, and repeated-measures experiments were the rule rather than the exception. I therefore started writing a series of QuickBASIC programs to analyse those designs on my PC. In the early 1990s, nonlinear response models became increasingly popular, and I had to write my first Gauss-Newton optimiser, again in QuickBASIC. Generalised linear models were not yet widely used by biologists, so I mainly relied on variance-stabilising transformations whenever the assumptions of linear or nonlinear models were not met.</p>
<p>That rather humble statistical life gave me an undeniable advantage: it forced me to study and understand the principles behind every new method and algorithm before I could even think of programming it. I had to become familiar with all those strange mathematical objects—matrices, eigenvalues, determinants—which are not usually part of a biologist’s mathematical background (at least in Italy). And once my BASIC programs were finished, they could do only what they had been programmed to do: solve one specific problem, in one specific way. No additional options, no hidden defaults, no unexpected behaviour. In short, no general-purpose solutions.</p>
<p>Today I have R. It is free, incredibly powerful, and almost anything is possible. With just a few lines of code, I can fit almost any model that comes to mind in a matter of minutes. I can compare several alternatives: Which one is the best? Which one tells the story I would like my data to tell? Biometry textbooks have changed as well. They have become much more algorithm-oriented, while the mathematics is often confined to boxes that can easily be skipped. I have to admit that I often skip them myself: a few code snippets are usually enough to get the job done, and if they are not, I can find thousands more on the Internet. So why should I bother studying an abstract subject like statistics when I have R?</p>
<p>Of course, this is an exaggeration. Nevertheless, I sometimes wonder whether the widespread availability of such a powerful free tool has a downside. Biologists—especially students—may mistake learning R for learning statistics. I am often surprised by how many sophisticated models are fitted nowadays with little biological or statistical justification, and with very little attention paid to the assumptions on which those models rely.</p>
<p>A few days ago, a PhD student in my department proudly showed me the results of a reduced-rank regression fitted to a biological dataset. He was particularly pleased that he had managed to write the correct R code after a long search on the Internet. He had even succeeded in getting rid of a “rather strange” warning message. Unfortunately, he had misunderstood what that warning meant, and the analysis had therefore been incorrect from the very beginning.</p>
<p>So here is a friendly reminder to all biologists—including myself. R is a wonderful piece of software, but it does not automatically lead to sound statistical analyses.</p>
<p>Let’s use R—but let’s study stats first!</p>
<hr>
<p>Prof.&nbsp;Andrea Onofri<br>
Department of Agricultural, Food and Environmental Sciences<br>
University of Perugia (Italy)<br>
Send comments to: <a href="mailto:andrea.onofri@unipg.it">andrea.onofri@unipg.it</a></p>
<p><a href="https://www.awin1.com/cread.php?awinmid=26429&amp;awinaffid=2675822&amp;ued=https%3A%2F%2Flink.springer.com%2Fbook%2F10.1007%2F978-3-032-08199-5"><img src="https://www.statforbiology.com/Figures/Email_Signature_978-3-032-08199-5.png" alt="Book cover" class="cover" align="center"></a></p>



 ]]></description>
  <category>R</category>
  <guid>https://www.statforbiology.com/posts/R_TheDangerOfR.html</guid>
  <pubDate>Sat, 07 Jun 2014 22:00:00 GMT</pubDate>
</item>
</channel>
</rss>
