home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / bootstrap / bootpred < prev    next >
Encoding:
Text File  |  1997-09-13  |  2.3 KB  |  72 lines

  1.     
  2.     _b_o_o_t_s_t_r_a_p _e_s_t_i_m_a_t_e_s _o_f _p_r_e_d_i_c_t_i_o_n _e_r_r_o_r
  3.     
  4.          bootpred(x,y,nboot,theta.fit,theta.predict,err.meas,...)
  5.     
  6.     _A_r_g_u_m_e_n_t_s:
  7.     
  8.                 x: a matrix containing the predictor (regressor)
  9.                    values. Each row corresponds to an observa-
  10.                    tion.
  11.     
  12.                 y: a vector containing the response values
  13.     
  14.             nboot: the number of bootstrap replications
  15.     
  16.         theta.fit: function to be cross-validated. Takes x and y
  17.                    as an argument.  See example below.
  18.     
  19.     theta.predict: function producing predicted values for
  20.                    theta.fit.  Arguments are a matrix x of pred-
  21.                    ictors and fit object produced by theta.fit.
  22.                    See example below.
  23.     
  24.          err.meas: function specifying error measure for a sin-
  25.                    gle response y and prediction yhat
  26.                     - see examples below
  27.     
  28.     _V_a_l_u_e_s:
  29.     
  30.          list with the following components
  31.     
  32.      app.err: the apparent error rate- that is, the mean value
  33.               of err.meas when theta.fit is applied to x and y,
  34.               and then used to predict y.
  35.     
  36.        optim: the bootstrap estimate of optimism in app.err. A
  37.               useful estimate of prediction error is
  38.               app.err+optim
  39.     
  40.      err.632: the ".632" bootstrap estimate of prediction error.
  41.     
  42.     _R_e_f_e_r_e_n_c_e_s:
  43.     
  44.          Efron, B. (1983). Estimating the error rate of a pred-
  45.          iction rule: improvements on cross-validation. J. Amer.
  46.          Stat. Assoc, vol 78. pages 316-31.
  47.     
  48.          Efron, B. and Tibshirani, R. (1993) An Introduction to
  49.          the Bootstrap.  Chapman and Hall, New York, London.
  50.     
  51.     _E_x_a_m_p_l_e_s:
  52.     
  53.          # bootstrap prediction error estimation in least squares
  54.          #  regression
  55.          x <- rnorm(85)
  56.          y <- 2*x +.5*rnorm(85)
  57.          theta.fit <- function(x,y)lsfit(x,y)
  58.          theta.predict <- function(fit,x)
  59.                         cbind(1,x)%*%fitoef
  60.     
  61.          sq.err_function(y,yhat)  (y-yhat)^2
  62.          results <- bootpred(x,y,20,theta.fit,theta.predict,
  63.               err.meas=sq.err)
  64.     
  65.          # for a classification problem, a standard choice
  66.          # for err.meas would simply count up the
  67.          #  classification errors:
  68.          miss.clas <- function(y,yhat) 1*(yhat!=y)
  69.          # with this specification,  bootpred estimates
  70.          #  misclassification rate
  71.     
  72.