## does not work: cannot find the saddle distn
library(modreg) # for smooth.spline
# In this example we show how a plot such as that in Figure 9.9 of
# Davison and Hinkley (1997) may be produced. Note the large number of
# bootstrap replicates required in this example.
expdata <- rexp(12)
vfun <- function(d,i)
{ n <- length(d)
(n-1)/n*var(d[i])
}
exp.boot <- boot(expdata,vfun,R=9999)
exp.L <- (expdata-mean(expdata))^2-exp.boot$t0
exp.tL <- linear.approx(exp.boot,L=exp.L)
hist(exp.tL,nclass=50,prob=T)
exp.t0 <- c(0,sqrt(var(exp.boot$t)))
exp.sp <- saddle.distn(A=exp.L/12,wdist="m", t0=exp.t0)
# The saddlepoint approximation in this case is to the density of
# t-t0 and so t0 must be added for the plot.
lines(exp.sp,h=function(u,t0) u+t0, J=function(u,t0) 1,
t0=exp.boot$t0)
Run the code above in your browser using DataLab