So I have a data set with several different parameters, age, sex, etc. I also have an indicator of if any given subject has HIV or does not. I want to plot survival curves for these. I also have for each subject the time to death after diagnosis or the last time they were observed, and an indicator that tells us if they were censored or if they did indeed die.
So my question is, how do we account for censoring and how do we make a survival object that allows us to make separate estimates for survival for those who do have HIV and those who do not?
For example, my data is HIV.dataset
and I have some parameters,
Where the gender is a factorized version ie M or F. hiv is an indicator (1= HIV positive)
ind represents the indicator of death , 0 is censored and 1 is death
and time represents the time in days to death after diagnosis or the last time they were observed.
So I am not sure how I account for censoring. Is this something I include or do not include? How can I separate the cases to make separate curves, for example if I wanted a survival curve for those who do have HIV.
I know I should make use of survfit , and I would need a Surv object.
So in summary I am looking to better understand how to plot survival curves (using Kaplan-Meier Estimates) and how to account for censoring.