Wrapper function to find maximum likelihood solutions to two models to an evolutionary sequence.
fit.mode.shift(
y,
model1 = c("Stasis", "URW", "GRW", "OU"),
model2 = c("Stasis", "URW", "GRW", "OU"),
fit.all = FALSE,
minb = 7,
shift.point = NULL,
pool = TRUE,
silent = FALSE,
hess = FALSE
)the function returns a list of all investigated models and their highest log-likelihood (and their corresponding AICc and AICc weight).
the log-likelihood of the optimal solution
AIC with a correction for small sample sizes
parameter estimates
abbreviated model name
Joint consideration of all samples
number of parameters in the model
the number of observations/samples
log-likelihoods for all tested partitions of the series into segments. Will return a single value if shift points have been given
matrix of indices of initial samples of each tested segment configuration; each column of GG corresponds to the elements of all.logl
In addition, if fit.all=TRUE the function also returns a list of all investigated models and their highest log-likelihood (and their corresponding AICc and AICc weight).
an univariate evoTS object.
the model fitted to the first segment. Options are Stasis, URW, GRW, OU.
the model fitted to the second segment. Options are Stasis, URW, GRW, OU.
logical indicating whether to fit all pairwise combinations of the four models to the evolutionary sequence (time-series).
the minimum number of samples within a segment to consider
The sample that split the time-series into two segments. The samples are passed to the argument as a vector. Default is NULL, which means all possible shift points will be assessed constrained by how minb is defined.
logical indicating whether to pool variances across samples
if TRUE, less information is printed to the screen as the model is fit
logical, indicating whether to calculate standard errors from the Hessian matrix.
#'
Kjetil Lysne Voje
Hunt, G. 2006. Fitting and comparing models of phyletic evolution: random walks and beyond. Paleobiology 32:578–601
Hunt, G., Bell, M. A. & Travis, M. P. Evolution towards a new adaptive optimum: Phenotypic evolution in a fossil stickleback lineage. Evolution 62:700–710 (2008)
##Generate a paleoTS object.
x <- paleoTS::sim.GRW(30)
## Fit a mode-shift model without defining a shift point (the example may take > 5 seconds to run)
fit.mode.shift(x, model1="URW", model2="Stasis")
Run the code above in your browser using DataLab