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.

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

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

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.

Returns a `list`

:

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

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

`nullLR` |
optional, if |

Gene Hunt

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.

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

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.