Add New Replicates to a Bootstrap Object

DESCRIPTION:

Add replicates to a bootstrap object. This is a generic function; methods currently exist for , , and .

USAGE:

addSamples.bootstrap(object, B.add = 100, sampler.prob = NULL, ..., 
                     frame.eval = <<see below>>) 
addSamples.parametricBootstrap(object, B.add = 100, ..., frame.eval = <<see below>>) 
addSamples.smoothedBootstrap(object, B.add = 100, ..., frame.eval = <<see below>>) 

REQUIRED ARGUMENTS:

object
bootstrap object, of class , , or .

OPTIONAL ARGUMENTS:

B.add
number of additional replicates to construct. This may be a vector; see the B argument in .
sampler.prob
list of length equal to length(B.add); probabilities to be used for importance sampling. See for more information.
frame.eval
frame where the data and other objects used when creating object can be found. You need to specify this if objects can't be found by their original names, or have changed; see .

VALUE:

object like object, with additional replicates. The component B of the result is the sum of the total previous samples (component B of the old object) and the sum of elements of B.add. The component call$B of the result is a vector concatenating the previous call$B and B.add.

DETAILS:

If the original call (to , , or ) was interrupted, incomplete results (e.g. saved in .bootstrap.partial.results) may be extended with addSamples, but you must manually change the seed.end component to a legal seed argument first.

If object is a bootstrap object, components L and Lstar of the result are the same as for object: they are not updated to reflect the new samples.

SEE ALSO:

, , , .

For an annotated list of functions in the package, including other high-level resampling functions, see: .

EXAMPLES:

bfit <- bootstrap(stack.loss, median, B = 1000) 
bfit2 <- addSamples(bfit, B.add = 400) 
bfit2    # The call has "B = c(1000, 400)" 
 
#   Demonstrate adding samples after an interrupt 
# interrupt this next call after 200 replications or so 
bfit3 <- bootstrap(stack.loss, median, seed = bfit$seed.start) 
bfit3 <- .bootstrap.partial.results 
set.seed(bfit$seed.start) 
dummy <- samp.bootstrap(bfit3$n, bfit3$B)   # to update .Random.seed 
bfit3$seed.end <- .Random.seed     # manually change seed.end 
bfit4 <- addSamples(bfit3, B.add = 1400-bfit3$B) 
all.equal(bfit2, bfit4)            # same except for call, actual.calls 
all.equal.excluding(bfit2, bfit4, excluding= c("call", "actual.calls")) # T 
 
# parametricBootstrap 
bfit <- parametricBootstrap(iris[,1,1], mean, rsampler = rnorm, 
         args.rsampler = list(mean = mean(iris[,1,1]), 
         sd = sqrt(var(iris[,1,1]))), B = 600) 
bfit2 <- addSamples(bfit, B.add = c(300,100)) 
bfit3 <- update(bfit, B=c(600, 300, 100), seed=bfit$seed.start) 
all.equal(bfit2, bfit3)            # same except for call, actual.calls 
all.equal.excluding(bfit2, bfit3, excluding= c("call", "actual.calls")) # T 
 
# smoothedBootstrap 
bfit <- smoothedBootstrap(stack.loss, mean, B = 600) 
bfit2 <- addSamples(bfit, B.add = c(300,100)) 
bfit3 <- smoothedBootstrap(stack.loss, mean, seed = bfit$seed.start, B = 1000) 
all.equal(bfit2, bfit3)            # same except for call, actual.calls 
all.equal.excluding(bfit2, bfit3, excluding= c("call", "actual.calls")) # T