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 modelling.
There are three main differences between non-linear and linear modelling in R:
1. specify the exact nature of the equation
2. replace the
nls() which means nonlinear least squares
3. sometimes we also need to specify the model parameters a,b, and c.
In this exercise, we will use the same dataset as the previous exercise in polynomial regression here. Download the data-set here.
A quick overview of the dataset.
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.
Load dataset. Specify the model, try to use power function with
nls() and a=0.1 and b=1 as initial parameter number
A quick check by creating plot residual versus fitted model since normal plot will not work
Try to build self start function of the powered model
Generate the asymptotic model
Compared the asymptotic model to the powered one using AIC. What can we infer?
Plot the model in one graph
Predict across the data and plot all three lines