Fits multiple rate models of correlated evolution between one, two, or three binary traits to paintings on branches
corPAINT(phy,data, ntraits=2, rate.mat=NULL, model=c("ER","SYM","ARD"),
node.states=c("joint", "marginal", "scaled"), p=NULL, root.p=NULL, ip=NULL,
lb=0, ub=100,diagn=FALSE)
a phylogenetic tree, in ape
“phylo” format.
a data matrix containing species information (see Details).
specifies the number of traits to included in the analysis.
a user-supplied rate matrix index of parameters to be optimized.
specifies the underlying model.
method used to calculate ancestral states at internal nodes (see Details).
a vector of transition rates. Allows the user to calculate the likelihood given a specified set of parameter values to specified as fixed and calculate the likelihood.
a vector used to fix the probabilities at the root, but “yang” and “maddfitz” can also be supplied to use the method of Yang (2006) and FitzJohn et al (2009) respectively (see details).
initial values used for the likelihood search. Can be a single value or a vector of unique values for each parameter. The default is ip=1
.
lower bound for the likelihood search. The default is lb=0
.
upper bound for the likelihood search. The default is ub=100
.
logical indicating whether diagnostic tests should be performed. The default is FALSE
.
corPAINT
returns an object of class corPAINT
. This is a list with elements:
the maximum negative log-likelihood.
Akaike information criterion.
Akaike information criterion corrected for sample size.
The number of traits specified.
a matrix containing the maximum likelihood estimates of the transition rates.
a matrix containing the approximate standard errors of the transition rates. The standard error is calculated as the square root of the diagonal of the inverse of the Hessian matrix.
The indices of the parameters being estimated are returned. The numbers correspond to the row in the eigvect
and can useful for identifying the parameters that are causing the objective function to be at a saddlepoint.
Internal settings of the likelihood search
User-supplied dataset.
User-supplied tree.
The likeliest states at each internal node.
NULL
The number of iterations used by the optimization routine.
The eigenvalues from the decomposition of the Hessian of the likelihood function. If any eigval<0
then one or more parameters were not optimized during the likelihood search
The eigenvectors from the decomposition of the Hessian of the likelihood function is returned
The function fits a model that applies different transition models between one, two or three binary characters based on the user-defined painting of branches on the tree of discrete "selective regimes". The trait file must be contructed in the following way: the first column of the trait file must contain the species labels to match to the tree, with the second, and so on, corresponding to the binary traits of interest. The last column in the trait file defines the current "selective regime" for each tip. The user can fix the root state probabilities by supplying a vector to the root.p
, otherwise, the program assumes the marginal probability for the root. Also, like all other functions scoring information that is missing for a species can be incorporated in the analysis by including an NA for that particular trait. NOTE THAT ALTHOUGH THIS FUNCTION SHOULD WORK, IT IS CURRENTLY BEING DEVELOPED. SO USE AT YOUR OWN RISK.
# NOT RUN {
# Not run
## Load tree and data
# data(primates.paint)
## Obtain the fit for two binary characters
# pp.null<-corDISC(primates.paint$tree,primates.paint$trait,ntraits=2,model="ER",
# node.states="marginal")
# pp.null
# pp.paint<-corPAINT(primates.paint$tree,primates.paint$trait,ntraits=2,model="ER",
# node.states="marginal")
# pp.paint
# }
Run the code above in your browser using DataCamp Workspace