Learn R Programming

paleoTS (version 0.5-1)

bootSimpleComplex: Use parametric bootstrapping to test the fit of a complex model relative to a simpler one

Description

Tests if a complex model fit is significantly better than that of a simple model, treating the simple model as the null hypothesis and using the log-likelihood ratio as a test statistic.

Usage

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

Arguments

y

a paleoTS object

simpleFit

a paleoTSfit object corresponding to a simple model (GRW, URW, Stasis or StrictStasis)

complexFit

a paleoTSfit object corresponding to a complex model (from fitGpunc or fitStasisRW)

nboot

number of boostrap replications

minb

the minimum number of segments to require before and after the mode shift

ret.full.distribution

logical, if TRUE, the vectore of test statistics for all replicates is returned

parallel

logical, if TRUE, the replicates are parallelized using foreach

further arguments, passed to the optimization functions

Value

Returns a list:

LRobs

the observed log-likelihood ratio statistic

p.value

p-value of the test

nullLR

optional, if ret.full.distribution=TRUE, the vector of LR test statistics for the bootstrap replications

Details

Simulations performed in Hunt et al. (2015) showed that the AICc can unduly favor complex models in this context. The behavior is known in other situations in which a large number of possible shifts are evaluated.

The parallel option uses doParallel and foreach. It detects the number of available cores and uses that number minus one for the parallelization.

References

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

See Also

fit9models, fitModeShift

Examples

Run this code
# NOT RUN {
	x<- sim.GRW(ns=40)
	mS<- fitSimple(x, model="URW", method="Joint")
	mC<- fitModeShift(x, order="Stasis-RW", rw.model="URW", method="Joint")
	compareModels(mS, mC)  ## AICc comparisons
	
	
# }
# NOT RUN {
	boot<- bootSimpleComplex(x, mS, mC, nboot=20)
	cat("Bootstrap p-value: ", boot$p.value, "\n")
	
# }

Run the code above in your browser using DataLab