Download the template R markdown file for this workshop.
In this exercise you will:
You need to have installed R, RStudio, and the necessary packages for
the course, including the ELMER
package. See how to
get set up for this course
data(TreeDiams, package="ELMER")
str(TreeDiams)
'data.frame': 12 obs. of 2 variables:
$ Diameter: num 0.9 1.2 2.9 3.1 3.3 3.9 4.3 6.2 9.6 12.6 ...
$ Height : num 18 26 32 36 44.5 35.6 40.5 57.5 67.3 84 ...
Fit the models used in the example in Chapter 1 of ELMER.
Just create the graph that shows the fitted models on the original data scale because this is the one that is important.
N.B. You should try to do this using ggplot()
if you
can. To get the curves of your models on your scatter plot, you might
make use of geom_function()
Use predict()
to find the fitted values from the three
models used so far. Use kable()
to put them into a nice
table.
Calculate a regression of height on diameter and height on
log(Diameter)
omitting the largest tree in the
TreeDiams
data.
Replot the scatter plots using the reduced data, with the fitted lines added.
Which of the two regressions would you choose, and why?
You should compare your work with the solutions for this workshop.