# Introduction

Very rarely, biological processes follow linear trends. Just think about how a crop grows, or how it responds to increasing doses of fertilisers/xenobiotics. Furthermore, think about how an herbicide degrades in soil, or what the germination time-course for a seed population looks like. It is very easy to realise that curvilinear trends are far more common than linear trends and asymptotes and/or inflection points are very common in nature. We can be sure: linear equations in biology are just a way to approximate a response over a very narrow range for the independent variable.

Therefore, as biologists, we need to be able to describe our experimental data by using a wide range of curvilinear equations. We need to be able to ‘read’ those equations and use their parameters to interpret and summarise our research data. Therefore, nonlinear regression should be a very useful tool in biology and we should master it properly. This tutorial is written to support those who would like use R to perform their nonlinear regression analyses. In particular, you will find answers to the following questions:

1. What is nonlinear regression?
2. How do I fit a nonlinear regression model with R?
3. How do I select the correct model for my data?
4. How do I check that the model fits good?
5. How do I use the estimated parameters for further calculations?

# The R package

When it comes to performing nonlinear regression in R, I have a strong personal preference for the ‘drc’ package and the ‘drm()’ function therein (Ritz et al. 2015). However, it is also worth mentioning the traditional ‘nls()’ function in the ‘stats’ package, which may turn out useful in a few circumstances.

Using the above packages I felt the need of building a few R functions, to accomplish some repetitive tasks, which had not been considered by the authros of the above mentioned packages. I implemented those functions in the aomisc package, together with several useful datasets that I often use for teaching purposes. The ‘aomisc’ package is available from ‘gitHub’; to install it, you need to have installed the ‘devtools’ package. The code is as follows:

# install.packages("devtools")
# library(devtools)
# install_github("OnofriAndreaPG/aomisc")

Happy work through this tutorial!