Preface

R packages

In this practical, a number of R packages are used. If any of them are not installed you may be able to follow the practical but will not be able to run all of the code. The packages used (with versions that were used to generate the solutions) are:

  • R version 3.6.1 (2019-07-05)
  • mice (version: 3.6.0)
  • nlme (version: 3.1.140)
  • JointAI (version: 0.6.0)
  • splines (version: 3.6.1)
  • ggplot2 (version: 3.2.1)

Dataset

In this practical we will work with data from a trial on primary biliary cirrhosis (PBC) of the liver.

To get the pbclong data, load the file pbclong.RData. You can download it here. To load this dataset, you can use the command file.choose() which opens the explorer and allows you to navigate to the location of the downloaded file on your computer. If you know the path to the file, you can also use load("<path>/<pbclong.RData").

The variables contained in the dataset pbclong are:

id patient identifier
day continuously measured day of follow-up time (the time variable)
sex patients’ sex (f: female, m: male)
trt treatment group (0: D-penicillmain, 1: placebo)
age patients’ age at intake
ascites presence of ascites at baseline (0:no, 1:yes)
hepato presence of hepatomegaly or enlarged liver
bili serum bilirubin level at baseline
copper urine copper (ug/day)
albumin serum albumin level at follow-up (time-varying)

The variables have the following distributions and proportions of missing values: