Use Cox regression to model the cause-specific survival of patients with skin melanoma (including all stages).
library('knitr') read_chunk('../q12.R') opts_chunk$set(cache=FALSE)
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 and explore it.
Without adjusting for potential confounders, we see that females have a 37% lower mortality rate than males.
After adjusting for a range of potential confounders, we see that the estimated difference in cancer-specific mortality between males and females has decreased slightly but there is still quite a large difference.
Let’s first estimate the effect of gender for each age group without adjusting for confounders.
We see that there is some evidence that the survival advantage experienced by females depends on age. The hazard ratio for males/females in the youngest age group is 0.46, while in the highest age group the hazard ratio is 0.68. There is evidence that the hazard ratios for gender differ across the age groups (p=0.0037). However, after adjusting for stage, subsite, and period there is no longer evidence of an interaction.
There is not strong evidence in support of the hypothesis (although some may consider that there is weak evidence).
After having fitted a main effects model we can check the proportional hazards assumption by fitting a regression line through the model-based Schoenfeld residulas and check if the slope is statistically different from zero.
There is strong evidence that the proportional hazard assumption is not satisfied for the effect of stage. Unless our primary interest is in the stage effect we can fit a stratified Cox model where we stratify on stage (i.e. estimate a separate baseline hazard function for each stage group).
If we re-do a test for non-proportional hazards we find that there is no longer evidence that any of the remaining covariates effects seem to depend on time since diagnosis.
Having accounted for the time-dependent effect of stage, there is still no evidence that the effect of sex is modified by age at diagnosis.
If you have time make sure you check for additional interaction terms between the remaining covariates, i.e. between age at diagnosis and stage.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.