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
startingModel(otree, odata, shifts = NULL, brownian = FALSE)
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
.
Phylogenetic tree in ouchtree
format
Data frame with rownames corresponding to otree@labels
A named character vector of regime shifts. Names should correspond to otree@nodes
, and regime assignments can be any character other than "a"
(see details). Defaults to NULL
, in which case a single-regime OU model is returned.
A logical indicating whether to return the fitted Brownian motion model for the data set by calling the ouch
function brown
and obtaining AICs by adding log-likelihoods across traits. If TRUE, overrides any specified shifts
Travis Ingram
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
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.
surfaceForward
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"))
Run the code above in your browser using DataLab