Description Usage Arguments Value References Examples
See Efron and Tibshirani (1993) for details on this function.
1 |
x |
a matrix containing the predictor (regressor) values. Each row corresponds to an observation. |
y |
a vector containing the response values |
nboot |
the number of bootstrap replications |
theta.fit |
function to be cross-validated. Takes |
theta.predict |
function producing predicted values for
|
err.meas |
function specifying error measure for a single
response |
... |
any additional arguments to be passed to
|
list with the following components
app.err |
the apparent error rate - that is, the mean value of
|
optim |
the bootstrap estimate of optimism in |
err.632 |
the ".632" bootstrap estimate of prediction error. |
call |
The deparsed call |
Efron, B. (1983). Estimating the error rate of a prediction rule: improvements on cross-validation. J. Amer. Stat. Assoc, vol 78. pages 316-31.
Efron, B. and Tibshirani, R. (1993) An Introduction to the Bootstrap. Chapman and Hall, New York, London.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # bootstrap prediction error estimation in least squares
# regression
x <- rnorm(85)
y <- 2*x +.5*rnorm(85)
theta.fit <- function(x,y){lsfit(x,y)}
theta.predict <- function(fit,x){
cbind(1,x)%*%fit$coef
}
sq.err <- function(y,yhat) { (y-yhat)^2}
results <- bootpred(x,y,20,theta.fit,theta.predict,
err.meas=sq.err)
# for a classification problem, a standard choice
# for err.meas would simply count up the
# classification errors:
miss.clas <- function(y,yhat){ 1*(yhat!=y)}
# with this specification, bootpred estimates
# misclassification rate
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.