This vignette presents dataset_by_exercise, the index
that links every data set in sta310r to the worked examples
in Collett (2023) that use it. The same index is available as a data
set, so you can filter and sort it in R rather than reading it here.
The dX.Y aliases
Each example that uses a data set gives that data set an alias
dX.Y, where X.Y is the number of the example.
For example, Example 3.7 uses the myeloma data, so
d3.7 is an alias for myeloma:
A data set that is used in more than one example has one alias per
example. The aliases are ordinary data objects in the package, so
d3.7 works after library(sta310r) just like
myeloma does, and ?d3.7 opens the help page of
the data set. The index below is the authoritative list of which alias
belongs to which example.
Index by data set
One row per data set, with its aliases and example numbers collapsed into a single string. The full index, with one row per data set and example, is in the next section.
| Data set | Title | Aliases | Examples | Rows | Variables |
|---|---|---|---|---|---|
| aortic | Survival following aortic valve replacement | d8.5, d8.6, d8.7, d8.8, d8.9 | 8.5, 8.6, 8.7, 8.8, 8.9 | 988 | 11 |
| bladder | Recurrence of bladder cancer | — | — | 86 | 6 |
| bmt | Bone marrow transplantation in leukaemia patients | — | — | 37 | 9 |
| bmt_leukaemia | Bone marrow transplantation in the treatment of leukaemia | d8.2 | 8.2 | 23 | 8 |
| bmt_outcome | Patient outcome following bone marrow transplantation | d13.4 | 13.4 | 2204 | 9 |
| breast | Prognosis for women with breast cancer | d1.2, d2.11, d2.12, d2.13, d2.14, d3.1, d3.3, d5.5, d5.6, d5.7, d5.8, d5.13, d5.14, d5.17, d10.1, d10.2, d16.4, d16.5, d16.6 | 1.2, 2.11, 2.12, 2.13, 2.14, 3.1, 3.3, 5.5, 5.6, 5.7, 5.8, 5.13, 5.14, 5.17, 10.1, 10.2, 16.4, 16.5, 16.6 | 45 | 3 |
| breast_rfs | Recurrence-free survival in breast cancer patients | d6.5, d6.6 | 6.5, 6.6 | 686 | 11 |
| cgd | Chronic granulomatous disease | — | — | 128 | 12 |
| cirrhosis | Data from a cirrhosis study (baseline) | d8.4 | 8.4 | 12 | 6 |
| cirrhosis_cp | Data from a cirrhosis study (counting process format) | — | — | 54 | 7 |
| cirrhosis_lbr | Data from a cirrhosis study (log-bilirubin data) | — | — | 42 | 3 |
| dialysis | Infection in patients on dialysis | d4.1, d4.2, d4.3, d4.4, d4.6, d4.7, d4.10, d4.11, d4.12 | 4.1, 4.2, 4.3, 4.4, 4.6, 4.7, 4.10, 4.11, 4.12 | 13 | 5 |
| ducks | Survival of black ducks | — | — | 50 | 6 |
| gastric | Survival of patients with gastric cancer | d11.2, d11.3 | 11.2, 11.3 | 90 | 4 |
| help | Health evaluation and linkage to primary care | d16.7 | 16.7 | 447 | 7 |
| hepatitis | Chronic active hepatitis | d15.1, d15.2, d15.3 | 15.1, 15.2, 15.3 | 44 | 3 |
| hyper | Treatment of hypernephroma | d3.4, d3.10, d3.11, d3.13, d3.14, d5.10, d6.1, d6.4 | 3.4, 3.10, 3.11, 3.13, 3.14, 5.10, 6.1, 6.4 | 36 | 4 |
| iud | Time to discontinuation of an intrauterine device (IUD) | d1.1, d2.3, d2.4, d2.5, d2.7, d2.8, d2.9, d2.10, d5.1, d5.2, d5.3, d5.4, d16.1, d16.2, d16.3 | 1.1, 2.3, 2.4, 2.5, 2.7, 2.8, 2.9, 2.10, 5.1, 5.2, 5.3, 5.4, 16.1, 16.2, 16.3 | 18 | 2 |
| kidney | Survival following kidney transplantation | d10.4 | 10.4 | 434 | 7 |
| kidney_centres | Comparisons between kidney transplant centres | d11.4, d11.5, d11.6, d11.7, d11.8 | 11.4, 11.5, 11.6, 11.7, 11.8 | 1439 | 9 |
| liver | Survival of liver transplant recipients | d12.1, d12.2, d12.3, d12.4, d12.5, d12.6 | 12.1, 12.2, 12.3, 12.4, 12.5, 12.6 | 1761 | 7 |
| liver_wait | Time to death while waiting for a liver transplant | d14.1, d14.3 | 14.1, 14.3 | 281 | 7 |
| lung_transplant | Survival of patients registered for a lung transplant | d10.3 | 10.3 | 196 | 7 |
| melanoma | Survival times of patients with melanoma | d2.15, d2.16 | 2.15, 2.16 | 30 | 4 |
| mice | Survival of laboratory mice with competing causes of death | d12.7 | 12.7 | 181 | 3 |
| myeloma | Survival of multiple myeloma patients | d1.3, d2.2, d2.6, d3.2, d3.5, d3.7, d3.8, d3.9, d3.15, d3.17, d3.19, d3.20, d4.5, d4.8, d4.9, d5.16 | 1.3, 2.2, 2.6, 3.2, 3.5, 3.7, 3.8, 3.9, 3.15, 3.17, 3.19, 3.20, 4.5, 4.8, 4.9, 5.16 | 48 | 10 |
| numerical_illustration | A numerical illustration of two factors | d5.9 | 5.9 | 37 | 4 |
| ovarian | Chemotherapy in ovarian cancer patients | d5.11, d5.12, d7.1, d7.2, d7.3, d7.4, d8.3 | 5.11, 5.12, 7.1, 7.2, 7.3, 7.4, 8.3 | 26 | 7 |
| prostate | Comparison of two treatments for prostatic cancer | d1.4, d3.6, d3.12, d3.16, d5.15 | 1.4, 3.6, 3.12, 3.16, 5.15 | 38 | 8 |
| pulmonary | Pulmonary metastasis in patients with osteosarcoma | d2.1 | 2.1 | 11 | 1 |
| rats | Recurrence of mammary tumours in female rats | d13.2 | 13.2 | 254 | 4 |
| scottish_mbc_cohort | Synthetic Scottish metastatic breast cancer cohort | — | — | 850 | 21 |
| tamoxifen | Clinical trial of tamoxifen in breast cancer patients | d13.3 | 13.3 | 641 | 18 |
| ulcer | Recurrence of an ulcer | d9.1, d9.4, d9.5, d9.6, d9.7, d11.1 | 9.1, 9.4, 9.5, 9.6, 9.7, 11.1 | 43 | 6 |
Index by example
The full index, ordered by chapter and example. Rows without an alias
are data sets that are not used in a numbered example; the
note column says where they come from.
| Example | Alias | Data set | Example title | Note |
|---|---|---|---|---|
| 1.1 | d1.1 | iud | Time to discontinuation of the use of an IUD | |
| 1.2 | d1.2 | breast | Prognosis for women with breast cancer | |
| 1.3 | d1.3 | myeloma | Survival of multiple myeloma patients | |
| 1.4 | d1.4 | prostate | Comparison of two treatments for prostatic cancer | |
| 2.1 | d2.1 | pulmonary | Pulmonary metastasis | |
| 2.2 | d2.2 | myeloma | Survival of multiple myeloma patients | |
| 2.3 | d2.3 | iud | Time to discontinuation of the use of an IUD | |
| 2.4 | d2.4 | iud | Time to discontinuation of the use of an IUD | |
| 2.5 | d2.5 | iud | Time to discontinuation of the use of an IUD | |
| 2.6 | d2.6 | myeloma | Survival of multiple myeloma patients | |
| 2.7 | d2.7 | iud | Time to discontinuation of the use of an IUD | |
| 2.8 | d2.8 | iud | Time to discontinuation of the use of an IUD | |
| 2.9 | d2.9 | iud | Time to discontinuation of the use of an IUD | |
| 2.10 | d2.10 | iud | Time to discontinuation of the use of an IUD | |
| 2.11 | d2.11 | breast | Prognosis for women with breast cancer | |
| 2.12 | d2.12 | breast | Prognosis for women with breast cancer | |
| 2.13 | d2.13 | breast | Prognosis for women with breast cancer | |
| 2.14 | d2.14 | breast | Prognosis for women with breast cancer | |
| 2.15 | d2.15 | melanoma | Survival times of patients with melanoma | |
| 2.16 | d2.16 | melanoma | Survival times of patients with melanoma | |
| 3.1 | d3.1 | breast | Prognosis for women with breast cancer | |
| 3.2 | d3.2 | myeloma | Survival of multiple myeloma patients | |
| 3.3 | d3.3 | breast | Prognosis for women with breast cancer | |
| 3.4 | d3.4 | hyper | Treatment of hypernephroma | |
| 3.5 | d3.5 | myeloma | Survival of multiple myeloma patients | |
| 3.6 | d3.6 | prostate | Comparison of two treatments for prostatic cancer | |
| 3.7 | d3.7 | myeloma | Survival of multiple myeloma patients | |
| 3.8 | d3.8 | myeloma | Survival of multiple myeloma patients | |
| 3.9 | d3.9 | myeloma | Survival of multiple myeloma patients | |
| 3.10 | d3.10 | hyper | Treatment of hypernephroma | |
| 3.11 | d3.11 | hyper | Treatment of hypernephroma | |
| 3.12 | d3.12 | prostate | Comparison of two treatments for prostatic cancer | |
| 3.13 | d3.13 | hyper | Treatment of hypernephroma | |
| 3.14 | d3.14 | hyper | Treatment of hypernephroma | |
| 3.15 | d3.15 | myeloma | Survival of multiple myeloma patients | |
| 3.16 | d3.16 | prostate | Comparison of two treatments for prostatic cancer | |
| 3.17 | d3.17 | myeloma | Survival of multiple myeloma patients | |
| 3.19 | d3.19 | myeloma | Survival of multiple myeloma patients | |
| 3.20 | d3.20 | myeloma | Survival of multiple myeloma patients | |
| 4.1 | d4.1 | dialysis | Infection in patients on dialysis | |
| 4.2 | d4.2 | dialysis | Infection in patients on dialysis | |
| 4.3 | d4.3 | dialysis | Infection in patients on dialysis | |
| 4.4 | d4.4 | dialysis | Infection in patients on dialysis | |
| 4.5 | d4.5 | myeloma | Survival of multiple myeloma patients | |
| 4.6 | d4.6 | dialysis | Infection in patients on dialysis | |
| 4.7 | d4.7 | dialysis | Infection in patients on dialysis | |
| 4.8 | d4.8 | myeloma | Survival of multiple myeloma patients | |
| 4.9 | d4.9 | myeloma | Survival of multiple myeloma patients | |
| 4.10 | d4.10 | dialysis | Infection in patients on dialysis | |
| 4.11 | d4.11 | dialysis | Infection in patients on dialysis | |
| 4.12 | d4.12 | dialysis | Infection in patients on dialysis | |
| 5.1 | d5.1 | iud | Time to discontinuation of the use of an IUD | |
| 5.2 | d5.2 | iud | Time to discontinuation of the use of an IUD | |
| 5.3 | d5.3 | iud | Time to discontinuation of the use of an IUD | |
| 5.4 | d5.4 | iud | Time to discontinuation of the use of an IUD | |
| 5.5 | d5.5 | breast | Prognosis for women with breast cancer | |
| 5.6 | d5.6 | breast | Prognosis for women with breast cancer | |
| 5.7 | d5.7 | breast | Prognosis for women with breast cancer | |
| 5.8 | d5.8 | breast | Prognosis for women with breast cancer | |
| 5.9 | d5.9 | numerical_illustration | A numerical illustration | |
| 5.10 | d5.10 | hyper | Treatment of hypernephroma | |
| 5.11 | d5.11 | ovarian | Chemotherapy in ovarian cancer patients | |
| 5.12 | d5.12 | ovarian | Chemotherapy in ovarian cancer patients | |
| 5.13 | d5.13 | breast | Prognosis for women with breast cancer | |
| 5.14 | d5.14 | breast | Prognosis for women with breast cancer | |
| 5.15 | d5.15 | prostate | Comparison of two treatments for prostatic cancer | |
| 5.16 | d5.16 | myeloma | Survival of multiple myeloma patients | |
| 5.17 | d5.17 | breast | Prognosis for women with breast cancer | |
| 6.1 | d6.1 | hyper | Treatment of hypernephroma | |
| 6.4 | d6.4 | hyper | Treatment of hypernephroma | |
| 6.5 | d6.5 | breast_rfs | Recurrence-free survival in breast cancer patients | |
| 6.6 | d6.6 | breast_rfs | Recurrence-free survival in breast cancer patients | |
| 7.1 | d7.1 | ovarian | Chemotherapy in ovarian cancer patients | |
| 7.2 | d7.2 | ovarian | Chemotherapy in ovarian cancer patients | |
| 7.3 | d7.3 | ovarian | Chemotherapy in ovarian cancer patients | |
| 7.4 | d7.4 | ovarian | Chemotherapy in ovarian cancer patients | |
| 8.2 | d8.2 | bmt_leukaemia | Bone marrow transplantation in the treatment of leukaemia | |
| 8.3 | d8.3 | ovarian | Chemotherapy in ovarian cancer patients | |
| 8.4 | d8.4 | cirrhosis | Data from a cirrhosis study | |
| 8.4 | NA | cirrhosis_cp | Data from a cirrhosis study | Counting process form of the cirrhosis study; used with Example 8.4, whose alias d8.4 is the baseline data. |
| 8.4 | NA | cirrhosis_lbr | Data from a cirrhosis study | Long-format log-bilirubin measurements for the cirrhosis study; used with Example 8.4, whose alias d8.4 is the baseline data. |
| 8.5 | d8.5 | aortic | Survival following aortic valve replacement | |
| 8.6 | d8.6 | aortic | Survival following aortic valve replacement | |
| 8.7 | d8.7 | aortic | Survival following aortic valve replacement | |
| 8.8 | d8.8 | aortic | Survival following aortic valve replacement | |
| 8.9 | d8.9 | aortic | Survival following aortic valve replacement | |
| 9.1 | d9.1 | ulcer | Recurrence of an ulcer | |
| 9.4 | d9.4 | ulcer | Recurrence of an ulcer | |
| 9.5 | d9.5 | ulcer | Recurrence of an ulcer | |
| 9.6 | d9.6 | ulcer | Recurrence of an ulcer | |
| 9.7 | d9.7 | ulcer | Recurrence of an ulcer | |
| 10.1 | d10.1 | breast | Prognosis for women with breast cancer | |
| 10.2 | d10.2 | breast | Prognosis for women with breast cancer | |
| 10.3 | d10.3 | lung_transplant | Survival of patients registered for a lung transplant | |
| 10.4 | d10.4 | kidney | Survival following kidney transplantation | |
| 11.1 | d11.1 | ulcer | Recurrence of an ulcer | |
| 11.2 | d11.2 | gastric | Survival of patients with gastric cancer | |
| 11.3 | d11.3 | gastric | Survival of patients with gastric cancer | |
| 11.4 | d11.4 | kidney_centres | Comparisons between kidney transplant centres | |
| 11.5 | d11.5 | kidney_centres | Comparisons between kidney transplant centres | |
| 11.6 | d11.6 | kidney_centres | Comparisons between kidney transplant centres | |
| 11.7 | d11.7 | kidney_centres | Comparisons between kidney transplant centres | |
| 11.8 | d11.8 | kidney_centres | Comparisons between kidney transplant centres | |
| 12.1 | d12.1 | liver | Survival of liver transplant recipients | |
| 12.2 | d12.2 | liver | Survival of liver transplant recipients | |
| 12.3 | d12.3 | liver | Survival of liver transplant recipients | |
| 12.4 | d12.4 | liver | Survival of liver transplant recipients | |
| 12.5 | d12.5 | liver | Survival of liver transplant recipients | |
| 12.6 | d12.6 | liver | Survival of liver transplant recipients | |
| 12.7 | d12.7 | mice | Survival of laboratory mice | |
| 13.2 | d13.2 | rats | Recurrence of mammary tumours in female rats | |
| 13.3 | d13.3 | tamoxifen | Clinical trial of tamoxifen in breast cancer patients | |
| 13.4 | d13.4 | bmt_outcome | Patient outcome following bone marrow transplantation | |
| 14.1 | d14.1 | liver_wait | Time to death while waiting for a liver transplant | |
| 14.3 | d14.3 | liver_wait | Time to death while waiting for a liver transplant | |
| 15.1 | d15.1 | hepatitis | Survival from chronic active hepatitis | |
| 15.2 | d15.2 | hepatitis | Survival from chronic active hepatitis | |
| 15.3 | d15.3 | hepatitis | Survival from chronic active hepatitis | |
| 16.1 | d16.1 | iud | Time to discontinuation of the use of an IUD | |
| 16.2 | d16.2 | iud | Time to discontinuation of the use of an IUD | |
| 16.3 | d16.3 | iud | Time to discontinuation of the use of an IUD | |
| 16.4 | d16.4 | breast | Prognosis for women with breast cancer | |
| 16.5 | d16.5 | breast | Prognosis for women with breast cancer | |
| 16.6 | d16.6 | breast | Prognosis for women with breast cancer | |
| 16.7 | d16.7 | help | Health evaluation and linkage to primary care | |
| NA | NA | bladder | NA | Collett (2023), Appendix B.2; no numbered example. |
| NA | NA | bmt | NA | Collett (2023), Appendix B.4; no numbered example. |
| NA | NA | cgd | NA | Collett (2023), Appendix B.5; no numbered example. |
| NA | NA | ducks | NA | Collett (2023), Appendix B.3; no numbered example. |
| NA | NA | scottish_mbc_cohort | NA | Course data set from the Edinburgh Cancer Informatics group; not from Collett (2023) and not used in a numbered example. |
Data sets without a numbered example
Four of the data sets from the book are used in the appendices rather
than in a numbered example, and the Scottish cohort is course material
rather than book data. They have no dX.Y alias:
| Data set | Title | Note | |
|---|---|---|---|
| 80 | cirrhosis_cp | Data from a cirrhosis study (counting process format) | Counting process form of the cirrhosis study; used with Example 8.4, whose alias d8.4 is the baseline data. |
| 81 | cirrhosis_lbr | Data from a cirrhosis study (log-bilirubin data) | Long-format log-bilirubin measurements for the cirrhosis study; used with Example 8.4, whose alias d8.4 is the baseline data. |
| 126 | bladder | Recurrence of bladder cancer | Collett (2023), Appendix B.2; no numbered example. |
| 127 | bmt | Bone marrow transplantation in leukaemia patients | Collett (2023), Appendix B.4; no numbered example. |
| 128 | cgd | Chronic granulomatous disease | Collett (2023), Appendix B.5; no numbered example. |
| 129 | ducks | Survival of black ducks | Collett (2023), Appendix B.3; no numbered example. |
| 130 | scottish_mbc_cohort | Synthetic Scottish metastatic breast cancer cohort | Course data set from the Edinburgh Cancer Informatics group; not from Collett (2023) and not used in a numbered example. |
The cirrhosis study is a special case. Example 8.4 uses three forms
of the same data: cirrhosis (the baseline values, alias
d8.4), cirrhosis_lbr (the log-bilirubin
measurements in long format) and cirrhosis_cp (the counting
process format). Only the baseline object has the alias; the other two
are listed with the same example but without an alias.
Using the index in R
Because the index is a data frame, you can query it directly:
# Which data set does Example 8.3 use?
dataset_by_exercise$dataset[dataset_by_exercise$example == "8.3"]
#> [1] "ovarian" NA NA NA NA NA
# Which examples use the myeloma data?
subset(dataset_by_exercise, dataset == "myeloma", c("alias", "example"))
#> alias example
#> 3 d1.3 1.3
#> 6 d2.2 2.2
#> 10 d2.6 2.6
#> 22 d3.2 3.2
#> 25 d3.5 3.5
#> 27 d3.7 3.7
#> 28 d3.8 3.8
#> 29 d3.9 3.9
#> 35 d3.15 3.15
#> 37 d3.17 3.17
#> 38 d3.19 3.19
#> 39 d3.20 3.20
#> 44 d4.5 4.5
#> 47 d4.8 4.8
#> 48 d4.9 4.9
#> 67 d5.16 5.16
# All data sets used in Chapter 3
unique(dataset_by_exercise$dataset[dataset_by_exercise$chapter == 3])
#> [1] "breast" "myeloma" "hyper" "prostate" NAThe index is generated by
data-raw/dataset_by_exercise.R. If a new data set is added,
or the example mapping changes, update that script and re-run it; it
recreates both dataset_by_exercise and the
dX.Y aliases.
Reproducing the book’s analyses
The help page of every data set shows how the analyses in Collett (2023) are carried out in R, with a comment for each example number. Each page has two parts:
-
Collett (2023), Chapter 17 style uses the functions
and packages of the book’s own R chapter:
survival::survfit(),survival::coxph(),survival::survdiff(),survival::survreg(),survival::cox.zph(),survival::tmerge(),survival::survSplit(),penalized::penalized(),eha::pchreg()andcmprsk::cuminc()/cmprsk::crr(). -
Modern tools repeats the same analysis with newer
packages:
ggsurvfit,flexsurv,coxme,icenReg,tidycmprsk,broom,rmsandglmnet.
For example, ?gastric shows the piecewise treatment
effect of Examples 11.2 and 11.3, and ?iud shows the
conjugate Bayesian analysis of Examples 16.1 to 16.3 alongside the
parametric models of Examples 5.1 to 5.4. Where the book uses a package
that is not a dependency of this package, the help page says so in a
comment and uses a runnable equivalent.