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>>)
B argument in
.
length(B.add); probabilities to be used for
importance sampling. See
for more information.
object can be found.
You need to specify this if objects can't be found by their
original names, or have changed; see
.
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.
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.
For an annotated list of functions in the package, including other high-level resampling functions, see: .
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