[R] bootstrap confidence bands

From: Geertje van der Heijden <g.m.f.vanderheijden_at_googlemail.com>
Date: Wed, 28 May 2008 22:38:04 +0100


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 28 May 2008 - 21:43:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 28 May 2008 - 23:30:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive