#********************************************************** # Data excerpted from NIH Multi Center AIDS Cohort Study. * # Cohort consists of gay and bisexual men. Variables are * # happy: self-reported level of happiness at enrollment * # time: time to death or loss to followup, * # entry: age at first follow-up, status: 1 for death, 0 ow* # life: finer self-reported happiness measure * # aaids: age at development of aids. * #********************************************************** library(survival) mcac<-as.data.frame(scan("mcac.dat", what=list(helth=0,life=0,happy=0,status=0,entry=0,time=0,aaids=0))) mcac<-mcac[mcac$helth>0,] mcac$aids<-FALSE mcac$neveraids<-mcac$aaids>=mcac$time mcac$person<-seq(length(mcac$time)) tempdat<-mcac; tempdat$aids<-TRUE bigmcac<-rbind(mcac,tempdat) bigmcac<-bigmcac[!(bigmcac$neveraids&bigmcac$aids),] bigmcac$entry[bigmcac$aids]<-bigmcac$aaids[bigmcac$aids] bigmcac$time[!bigmcac$aids]<-bigmcac$aaids[!bigmcac$aids] bigmcac<-bigmcac[bigmcac$entry