R version 4.2.2 Patched (2022-11-10 r83330) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> pdf("g12.pdf");options(width=64)
> #setwd("C:\\Users\\kolassa\\Class555")
> setwd("~/Taught1/960-555/Data")
> #*************************************************************/
> # Data from http://lib.stat.cmu.edu/datasets/Arsenic         */
> # reformatted into ASCII on the course home page.  Data re-  */
> # flect arsenic levels in toenail clippings; covariates in-  */
> # clude age, sex (1=M), categorical measures of quantities   */
> # used for drinking and cooking, arsenic in the water, and   */
> # arsenic in the nails.  To make arsenic.dat from Arsenic, do*/
> #antiword Arsenic|awk '((NR>39)&&(NR<61)){print}'>arsenic.dat*/
> #*************************************************************/
> arsenic<-read.table("arsenic.dat")
> names(arsenic)<-c("age","sex","drink","cook","water",
+    "nails")
> arsenic$status<-(arsenic$water>=.0001)+0
> arsenic$water[arsenic$water<.0001]<-.0001
> arsenic$lnail<-log(arsenic$nails)
> arsenic$lwater<-log(arsenic$water)
> meds<-rep(NA,999)
> for(j in seq(length(meds)))
+    meds[j]<-median(sample(arsenic$nails,length(arsenic$nails),
+       replace=TRUE))
> cat(ci<-quantile(meds,probs=c(.025,.975)),"\n")
0.119 0.31 
> cat('\n Residual Bootstrap for Median\n')

 Residual Bootstrap for Median
> cat(ci<-2*median(arsenic$nails)-rev(ci),"\n")
0.04 0.231 
>