##################################################### # R codes for profiling the PEL confidence interval # # a: value of 1-alpha (0.95 for 95% CI) # # YEL: Maximum PEL estimator of Ybar # # ys: vector of sampled y_i's # # nss: effective sample size # # # # (No auxiliary information is used!) # # # # Written by Changbao Wu, March, 2000 # ##################################################### tol<-1e-08 cut<-qchisq(a,1) #------------ t1<-YEL t2<-max(ys) dif<-t2-t1 while(dif>tol){ tau<-(t1+t2)/2 M<-Lag1(ys,ds,tau) elratio<-2*nss*sum(ds*log(1+M*(ys-tau))) if(elratio>cut) t2<-tau if(elratio<=cut) t1<-tau dif<-t2-t1 } UB<-(t1+t2)/2 #------------ t1<-YEL t2<-min(ys) dif<-t1-t2 while(dif>tol){ tau<-(t1+t2)/2 M<-Lag1(ys,ds,tau) elratio<-2*nss*sum(ds*log(1+M*(ys-tau))) if(elratio>cut) t2<-tau if(elratio<=cut) t1<-tau dif<-t1-t2 } LB<-(t1+t2)/2