A mechanistic model for the relationship between x and y sometimes needs parameter estimation. When model linearisation does not work,we need to use non-linear modeling.

There are three main differences between non-linear and linear modeling in R:

1. Specify the exact nature of the equation.

2. Replace the `lm()`

with `nls()`

, which means non-linear least squares.

3. Sometimes we also need to specify the model parameters a, b and c.

In this exercise, we will use the same data-set as the previous exercise in polynomial regression here. Download the data-set here.

A quick overview of the data-set:

Response variable = number of invertebrates (INDIV)

Explanatory variable = the area of each clump (AREA)

Additional possible response variables = Species richness of invertebrates (SPECIES)

Answers to these exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.

**Exercise 1**

Load the data-set; specify the model. Try to use the power function with `nls()`

and a=0.1 and b=1 as the initial parameter number.

**Exercise 2**

Do a quick check by creating a plot residual vs. a fitted model, since a normal plot will not work.

**Exercise 3**

Try to build a self-start function of the powered model.

**Exercise 4**

Generate the asymptotic model.

**Exercise 5**

Compared the asymptotic model to the powered one using AIC. What can we infer?

**Exercise 6**

Plot the model in one graph.

**Exercise 7**

Predict across the data and plot all three lines.

**What's next:**

- Explore all our (>1000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below

## Leave a Reply