bootSimpleComplex: Bootstrap test to see if a complex model is significantly...

View source: R/complexModels.R

bootSimpleComplexR Documentation

Bootstrap test to see if a complex model is significantly better than a simple model.

Description

Bootstrap test to see if a complex model is significantly better than a simple model.

Usage

bootSimpleComplex(
  y,
  simpleFit,
  complexFit,
  nboot = 99,
  minb = 7,
  ret.full.distribution = FALSE,
  parallel = FALSE,
  ...
)

Arguments

y

a paleoTS object

simpleFit

a paleoTSfit object, representing the model fit of a simple model

complexFit

a paleoTSfit object, representing the model fit of a complex model

nboot

number of replications for parametric bootstrapping

minb

minimum number of populations within each segment

ret.full.distribution

logical, indicating if the null distribution for the likelihood ratio from the parametric bootstrap should be returned

parallel

logical, if TRUE, the bootstrapping is done using parallel computing

...

further arguments, passed to optimization functions

Details

Simulations suggest that AICc can be overly liberal with complex models with mode shifts or punctuations (Hunt et al., 2015). This function implements an alternative of parametric bootstrapping to compare the fit of a simple model with a complex model. It proceeds in five steps:

  1. Compute the observed gain in support from the simple to complex model as the likelihood ratio, LR_obs = -2(logL_simple - logL_complex)

  2. Simulate trait evolution under the specified simple model nboot times

  3. Fit to each simulated sequence the specified simple and complex models

  4. Measure the gain in support from simple to complex as the bootstrap likelihood ratio for each simulated sequence

  5. Compute the P-value as the percentile of the bootstrap distribution corresponding to the observed LR.

Argument simpleFit should be a paleoTS object returned by the function fitSimple or similar functions (e.g., opt.joint.GRW, opt.GRW, etc.). Argument complexFit must be a paleoTS object returned by fitGpunc or fitModeShift.

Calculations can be sped up by setting parallel = TRUE, which uses functions from the doParallel package to run the bootstrap replicates in parallel, using one fewer than the number of detected cores.

Value

A list of the observed likelihood ratio statistic, LRobs, the P-value of the test, and the number of bootstrap replicates. If ret.full.distribution = TRUE, the null distribution of likelihood ratios generated by parametric bootstrapping is also returned.

References

Hunt, G., M. J. Hopkins and S. Lidgard. 2015. Simple versus complex models of trait evolution and stasis as a response to environmental change. PNAS 112(16): 4885-4890.

See Also

sim.Stasis.RW, fitModeShift

Examples

## Not run: 
x <- sim.Stasis.RW(ns = c(15, 15), omega = 0.5, ms = 1, order = "Stasis-RW")
ws <- fitSimple(x)
wc <- fitModeShift(x, order = "Stasis-RW", rw.model = "GRW")
bootSimpleComplex(x, ws, wc, nboot = 50, minb = 7)  # nboot too low for real analysis!

## End(Not run)

paleoTS documentation built on Aug. 9, 2022, 1:06 a.m.