startingModel {surface} | R Documentation |
Create an Initial Model for a SURFACE Analysis
Description
Generate a model to start a SURFACE analysis, or fit specific Hansen or Brownian motion models that can be compared to the models returned by SURFACE
Usage
startingModel(otree, odata, shifts = NULL, brownian = FALSE)
Arguments
otree |
Phylogenetic tree in |
odata |
Data frame with rownames corresponding to |
shifts |
A named character vector of regime shifts. Names should correspond to |
brownian |
A logical indicating whether to return the fitted Brownian motion model for the data set by calling the |
Details
For most analysis, this function is not accessed by the user, but is called from within surfaceForward
to initialize the run with a single-regime OU model. However, the user can optionally supply a starting model that imposes some regime shifts (e.g. if there is strong a priori reason to include them, or to evaluate how their inclusion changes the result of SURFACE analysis). If shifts
are supplied, they are always modified so that the first element codes a basal regime 'shift' c("1"="a")
. Thus, if any other element in shifts
is specified as regime "a"
, or has name "1"
, an error will be returned. startingModel
can also be used to obtain a fit (with AICc calculated after adding log-likelihoods across traits) for any hypothesized Hansen model or for Brownian motion (if brownian=TRUE
) for comparison with models returned by SURFACE
Value
A list of length 1 containing an object with the same structure as the lists returned by each iteration of surfaceForward
and surfaceBackward
(containing elements fit
, all_aic
, aic
, savedshifts
, and n_regimes
). This allows it to be supplied as argument starting_list
in a call to surfaceForward
.
Author(s)
Travis Ingram
References
Ingram, T. & Mahler, D.L. (2013) SURFACE: detecting convergent evolution from comparative data by fitting Ornstein-Uhlenbeck models with stepwise AIC. Methods in Ecology and Evolution 4: 416-425.
See Also
Examples
data(surfaceDemo)
tree<-surfaceDemo$tree
dat<-surfaceDemo$sim$dat
olist<-convertTreeData(tree,dat)
otree<-olist[[1]]; odata<-olist[[2]]
startmod<-startingModel(otree, odata, shifts = c("6"="b"))