# 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

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

### Arguments

`y` |
a |

`simpleFit` |
a |

`complexFit` |
a |

`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 |

`...` |
further arguments, passed to the optimization functions |

### 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.

### Value

Returns a `list`

:

`LRobs` |
the observed log-likelihood ratio statistic |

`p.value` |
p-value of the test |

`nullLR` |
optional, if |

### Author(s)

Gene Hunt

### 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

1 2 3 4 5 6 7 8 9 | ```
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
boot<- bootSimpleComplex(x, mS, mC, nboot=20)
cat("Bootstrap p-value: ", boot$p.value, "\n")
``` |