bootstrap: Bootstrapping for uncertainty quantification

Description Usage Arguments Details See Also Examples

Description

Parametric bootstrapping for ouch models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S4 method for signature 'missing'
bootstrap(object, ...)

## S4 method for signature 'ANY'
bootstrap(object, ...)

## S4 method for signature 'browntree'
bootstrap(object, nboot = 200, seed = NULL, ...)

## S4 method for signature 'hansentree'
bootstrap(object, nboot = 200, seed = NULL, ...)

Arguments

object

A fitted model object.

...

Additional arguments are passed to update.

nboot

integer; number of bootstrap replicates.

seed

integer; setting seed to a non-NULL value allows one to fix the random seed (see simulate).

Details

bootstrap performs a parametric bootstrap for estimation of confidence intervals.

See Also

Other methods for ouch trees: coef(), logLik, ouch-package, paint(), plot(), print(), simulate(), summary(), update()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## Not run: 
## Fit BM and a 5-regime OU model to the A. bimaculatus data
tree <- with(bimac,ouchtree(node,ancestor,time/max(time),species))

h1 <- brown(
  data=log(bimac['size']),
  tree=tree
)

h5 <- hansen(
  data=log(bimac['size']),
  tree=tree,
  regimes=bimac['OU.LP'],
  sqrt.alpha=1,
  sigma=1,
  reltol=1e-11,
  parscale=c(0.1,0.1),
  hessian=TRUE
)

## What are appropriate AIC.c cutoffs?
simdat <- simulate(h1,nsim=100,seed=92759587)
b1 <- sapply(simdat,function(x)summary(update(h1,data=x))$aic.c)
tic <- Sys.time()
b5 <- sapply(simdat,function(x)summary(update(h5,data=x))$aic.c)
toc <- Sys.time()
print(toc-tic)
cat("approximate 95% AIC.c cutoff",signif(quantile(b1-b5,0.95),digits=3),"\n")

## Bootstrap confidence intervals
boots.h1 <- bootstrap(h1,nboot=200,seed=92759587)
cat("bootstrap 95% confidence intervals for h1:\n")
print(t(sapply(boots.h1,quantile,probs=c(0.025,0.975))),digits=3)

boots.h5 <- bootstrap(h5,nboot=200,seed=92759587)
cat("bootstrap 95% confidence intervals for h5:\n")
print(t(sapply(boots.h5,quantile,probs=c(0.025,0.975))),digits=3)

## End(Not run)

ouch documentation built on May 17, 2021, 1:09 a.m.

Related to bootstrap in ouch...