The UnempDur dataset
The UnempDur
dataset contains information on how long people stay unemployed. In this case, the event (finding a job) is something positive. This information is stored in the censor1
variable, which has a value of 1
if an individual was re-employed at a full-time job. The spell
variable indicates the length of time an individual was unemployed in number of two-week intervals.
In this exercise, you'll explore these censored values and create a Surv
object, just as you did in the previous exercises with the GBSG2
dataset.
This exercise is part of the course
Survival Analysis in R
Exercise instructions
- Load the
UnempDur
dataset from theEcdat
package. - Count the number of censored and uncensored observations using the
table()
function. - Create a barplot of the number of censored and uncensored observations.
- Create a
Surv
object usingcensor1
and the variable describing duration.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Load the UnempDur data
___(___, ___)
# Count censored and uncensored data
cens_employ_ft <- ___(___)
cens_employ_ft
# Create barplot of censored and uncensored data
barplot(___)
# Create Surv-Object
sobj <- ___(___, ___)
# Look at 10 first elements
sobj[1:10]