[R] bootstrap confidence bands

Geertje van der Heijden
Wed, 28 May 2008 21:38:04 -0000

Hi all,

I have bootstrapped my weighted regression equation using the
following formula and the package boot to obtain bootstrap confidence
intervls for my parameters:

>drought <- read.table("D:/drought080525.txt", header=T)

>regres <- function(x, indices) {
>x <- x[indices,]
>coef(lm(x$AGB ~ x$days, weights=x$weights))
>}

>bst <- boot(drought, regres, R=10000, stype="i")

ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot(data = drought, statistic = regres, R = 10000, stype = "i")


Bootstrap Statistics :
      original      bias    std. error
t1*  0.4186985 0.010107259   0.6995259
t2* -0.4334417 0.001973715   0.1053180

>AGB_bstci1 <- boot.ci(bst, conf=0.95, type="bca",index=1)
>AGB_bstci2 <- boot.ci(bst, conf=0.95, type="bca",index=2)

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 10000 bootstrap replicates

CALL :
boot.ci(boot.out = bst, conf = 0.95, type = "bca", index = 1)

Intervals :
Level       BCa
95%   (-1.2767,  1.5678 )
Calculations and Intervals on Original Scale

BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 10000 bootstrap replicates

CALL :
boot.ci(boot.out = bst, conf = 0.95, type = "bca", index = 2)

Intervals :
Level       BCa
95%   (-0.5977, -0.1661 )
Calculations and Intervals on Original Scale

I would like to plot my regression line and the bootstrapped
confidence bands, but am a bit at a loss on how to convert the
bootstrapped confidence intervals for the parameters into a confidence
band for the regression line. Does anyone any ideas?

All help is greatly apprecited!

Many thanks,
Geertje