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
|