Practical Computing Exercise for Week 5 :The first River Problems exercise to use all the data

Download the template R markdown file for this workshop.

Aims of this practical exercise

In this exercise you will:

  • Complete the exercise given in ELMER
  • get some practice using R markdown
  • fit a variety of models to the entire RiverProbAll data.

Before you undertake this exercise…

Get the data

data(RiverProbAll, package="ELMER")
str(RiverProbAll)
'data.frame':   91 obs. of  4 variables:
 $ Flow    : int  24 24 26 26 50 48 72 72 25 23 ...
 $ Type    : Factor w/ 3 levels "Canadian","Kayak",..: 1 3 2 1 1 1 1 2 1 2 ...
 $ Problems: int  1 0 0 0 1 0 1 2 1 3 ...
 $ Type2   : logi  FALSE TRUE FALSE FALSE FALSE FALSE ...

The Exercise

The dataset RiverProbAll gives the number of problems experienced by travelers on the Whanganui river. This is the full data set including the craft type as a categorical variable.

Fit a generalised linear model to this data using a Poisson distribution for the number of problems and a log link function.

Use comparisons of the deviance to make any simplifications to a full model you find possible.

Hint: The categorical variable could be altered.

What to do next?

You should only move on to the second exercise using this dataset) once you have completed the above exercise.

Solutions

You should compare your work with the solutions for this workshop.