# Exercise 25. Localised melanoma : generating and analysing a nested case-control (NCC) study

You may have to install the required packages the first time you use them. You can install a package by `install.packages("package_of_interest")` for each package you require.

Load the melanoma data. Restrict the data to the localised status of the melanoma and to the 10 firts years of follow-up. Use the time-on-study as the timescale. define the event as death from cancer.

The Cox proportional hazard analysis is done thanks to the “coxph” command in the “survival” package. It is often a good idea to check first the structure of the variables.

## (a)

How many individuals are in the study?

## (b)

How many experience the event?

## (c1)

Generate a nested case-control study with 1 control per case. Cases and controls are matched on time since entry. This is done by using the function “cwcc” in the Epi package. Note that in the codes provided here, the variables “dc” and “id” are not necessary. They permit however to understand how the data are handled as for eample: how many individuals are sampled several times or how many cases happened to be sampled as controls before their failure time.

## (c2)

Analyse the nested case-control data (with the survival package or the Epi package) and function “clogit”. As the ncc data was generated with the Epi package, we use the syntax of this package.

## (d)

How many unique individuals are in our study?

## (f)

Generate several nested case-control study and analyse them. A loop is generated with M=20 sampling of NCC with 1 control per case. The codes provide the summary hazard ratios for each loop. The density for each HR is then plotted for each parameter, where the green density is for the full cohort study and the blue densites are for the nested case control studies. What do you observe?