A study by Caplehorn and Bell (1991) investigated the times that heroin addicts remained in a clinic for methadone maintenance treatment. The data included the amount of time (in days) that the subjects stayed in the facility until treatment was terminated. For about 37% of subjects, the study ended while they were still in the clinic (status = 0). Thus, their “survival time” has been “truncated.” For this reason, we might not want to focus on the mean survival time, but rather some other measure of a “typical” survival time, like the median or one of the quartiles. We will treat this group of 238 patients as representative of the population of heroin addicts.
heroinData = read.csv("http://people.hsc.edu/faculty-staff/blins/classes/spring18/math222/data/heroin.txt")
dim(heroinData)
## [1] 238 6
head(heroinData)
## id clinic status times prison dose
## 1 1 1 1 428 0 50
## 2 2 1 1 275 1 55
## 3 3 1 1 262 0 55
## 4 4 1 1 183 0 30
## 5 5 1 1 259 1 65
## 6 6 1 1 714 0 55
Make some plots that show the distribution of the times that people spent in treatment.
Make a bootstrap distribution for the median time. Plot and analyze the bootstrap distribution.
Find a bootstrap confidence interval for the median. Then repeat the process and find a confidence interval for the 75th-percentile.