library('knitr') read_chunk('../q3.R') opts_chunk$set(cache=FALSE, fig.width=10, fig.height=6)
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.
We will now analyse the full data set of patients diagnosed with localised skin melanoma. We start by reading the data selecting those with a localised stage and then define a 1/0 varible for the events that we are interested in.
There seems to be a clear difference in survival between the two periods. Patients diagnosed during 1985–94 have superior survival to those diagnosed 1975–84.
The plot shows the instantaneous cancer-specific mortality rate (the hazard) as a function of time. It appears that mortality is highest approximately 3.5 years following diagnosis. Remember that all patients were classified as having localised cancer at the time of diagnosis so we would not expect mortality to be high directly following diagnosis.
The plot of the hazard clearly illustrates the pattern of cancer-specific mortality as a function of time whereas this pattern is not obvious in the plot of the survivor function.
There is strong evidence that survival differs between the two periods. The log-rank and the Wilcoxon tests give very similar results. The Wilcoxon test gives more weight to differences in survival in the early period of follow-up (where there are more individuals at risk) whereas the log rank test gives equal weight to all points in the follow-up. Both tests assume that, if there is a difference, a proportional hazards assumption is appropriate.
We see that mortality increases with age at diagnosis (and survival decreases).
The rates are (cause-specific) deaths per 1000 person-years.
When we use Surv
we defined time as time in months divided by 12 and then asked
for rates per 1000 units of time.
What are the units of the estimated hazard rates? HINT: look at how you defined time.
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.