s-news
[Top] [All Lists]

Re: Problems with the bootstrap function and BCa CI

To: Olivier Renaud <Olivier.Renaud@pse.unige.ch>
Subject: Re: Problems with the bootstrap function and BCa CI
From: Tim Hesterberg <timh@insightful.com>
Date: 12 Dec 2005 17:07:32 -0800
Cc: Snews <s-news@wubios.wustl.edu>
In-reply-to: <6.2.1.2.0.20051209170433.01c96150@mail.pse.unige.ch> (message from Olivier Renaud on Fri, 09 Dec 2005 17:23:39 +0100)
References: <6.2.1.2.0.20051209170433.01c96150@mail.pse.unige.ch>
First, the limits.bca function should not be used when bootstrapping
residuals.  The calculations done by limits.bca assume that the order
of the data being resampled does not matter; that is expressly not true
when resampling residuals.  

I suggest using ordinary bootstrap percentile intervals.
The BCa makes corrections for bias and acceleration, but these
get muddled when you resample residuals.

Furthermore, note that when resampling observations, that limits.bca
is second-order correct (errors in one-sided coverage are O(1/n)) under
fairly general assumptions.  In contrast, when resampling residuals,
most intervals (classical intervals, bca, bootstrap percentile intervals,
etc.) are not even consistent (errors in one-sided coverage are O(1))
unless additional assumptions are made, in particular constant residual
variance.  So the corrections the BCa makes to get second-order correctness
are wasted.

As for the second question, a simpler way to resample residuals,
try the S+Resample library (download info below), which supports this
when resampling lm models:
        bootstrap(..., lmsampler="residuals")
or a checkbox in the menu interface.

Tim Hesterberg

>Hi,
>I'm trying to obtain confidence intervals for regression coefficients by 
>bootstrapping the residuals (raw here, could be standardized). Although the 
>basic results can be obtain with the print function, the CI cannot be computed 
>due to a problem in the limits.bca function (see code below). This happens 
>with the basic bootstrap function and the bootrap function from the resample 
>library. I am using S+ version 7 for Windows.
>By the way, if there is a simpler way to resample residuals ...
>Olivier
>
>x <- 1:10
>y <- x+rnorm(10)
>xy.lm <- lm(y~x)
>fittedy <- xy.lm$fitted
>resdf <- data.frame (resixy = xy.lm$resid)
>res.boot <- bootstrap(resdf, lm(I(fittedy + resixy) ~ x)$coef)
>
>##outputs:
>> print(res.boot)
>
>Call:
>bootstrap(data = resdf, statistic = lm(I(fittedy +
>        resixy) ~ x)$coef)
>
>Number of Replications: 1000 
>
>Summary Statistics:
>            Observed      Bias   Mean     SE 
>(Intercept)   0.4698  0.021692 0.4915 0.7048
>          x   0.9040 -0.003221 0.9007 0.1107
> 
>> summary(res.boot)
>Problem in fittedy + resixy: length of longer operan
>d (10) should be a multiple of length of shorter (9)
>Use traceback() to see the call stack
>
>> limits.bca(res.boot)
>Problem in fittedy + resixy: length of longer operan
>d (10) should be a multiple of length of shorter (9)
> Use traceback() to see the call stack
>
>
>Olivier.Renaud@pse.unige.ch        http://www.unige.ch/~renaud/ 
>Methodology and Data Analysis  -   Section of Psychology - FPSE      
>University of Geneva - 40, Bd du Pont d'Arve - CH-1211 Geneva 4 

========================================================
| Tim Hesterberg       Research Scientist              |
| timh@insightful.com  Insightful Corp.                |
| (206)802-2319        1700 Westlake Ave. N, Suite 500 |
| (206)283-8691 (fax)  Seattle, WA 98109-3012, U.S.A.  |
|                      www.insightful.com/Hesterberg   |
========================================================
Download the S+Resample library from www.insightful.com/downloads/libraries

Two Research Scientist positions:
        data mining
        frailty/mixed effects
    http://www.insightful.com/company/jobs.asp

Speak out about biased science in Washington D.C.
    http://home.comcast.net/~timhesterberg/ScientificIntegrity.html


<Prev in Thread] Current Thread [Next in Thread>