bootstrap: Fit model on Bootstrap sample

View source: R/bootstrap.R

bootstrapR Documentation

Fit model on Bootstrap sample

Description

These functions help to repeatedly fit a rfh model on bootstrap samples. Use bootstrap as a user interface. boot can be used to extend the framework but is not meant to be used interactively. If you are interested in the parameteric bootstrap for a 'rfh' model you can use the implementation in mse.

Usage

bootstrap(object, matV = variance(object), B = NULL, ...)

boot(object, matV, B, ...)

## S4 method for signature 'ANY,ANY,integerORnumeric'
boot(object, matV, B, filter = NULL, postProcessing = identity, ...)

## S4 method for signature 'rfh,rfhVariance,'NULL''
boot(object, matV, B, ...)

Arguments

object

a fitted object

matV

the variance of a fitted object used to draw samples. In most cases this is object. Alternatively it may be useful to use a non-robust model.

B

the number of repetitions

...

arguments passed down to methods

filter

a vector indicating which elements in the fittedd object to keep in each repetition.

postProcessing

a function to process the results. Is applied before the filter.

Examples

data(milk, package = "sae")
milk$samplingVar <- milk$SD^2
modelFit <- rfh(yi ~ as.factor(MajorArea), milk, "samplingVar")
bootstrapCoefs <- bootstrap(modelFit, B = 2, filter = "coefficients")
do.call(rbind, unlist(bootstrapCoefs, FALSE))

wahani/saeRobustTools documentation built on March 16, 2024, 11:29 a.m.