Practical Computing Exercise for Week 1 :Reworking of the baby weights example

Download the template R markdown file for this workshop.

Aims of this practical exercise

In this exercise you will:

  • rework the example given in ELMER
  • get some practice using R markdown

Before you undertake this exercise…

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(BabyWeights, package="ELMER")
str(BabyWeights)
'data.frame':   24 obs. of  3 variables:
 $ Age   : int  40 36 40 38 42 39 40 37 36 38 ...
 $ Weight: int  3317 2729 2935 2754 3210 2817 3126 2539 2412 2991 ...
 $ Gender: Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...

Fit all possible models

As per the example in ELMER, you need to fit five models. Make sure you label them carefully to match ELMER.

Make the graphs

N.B. You should try to do this using ggplot() if you can.

Starting with:

Graph0 = BabyWeights |> ggplot(aes(y=Weight,x=Age)) + geom_point(aes(col=Gender))

Make the tables of fitted values

Solutions

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