Description Usage Arguments Details Value Author(s) Examples
Generates and manipulates the index of the rate parameters to be optimized
1 2 3 4 | rate.mat.maker(rate.cat, hrm=TRUE, ntraits=NULL, nstates=NULL,
model=c("ER", "SYM", "ARD"))
rate.par.drop(rate.mat.index=NULL,drop.par=NULL)
rate.par.eq(rate.mat.index=NULL, eq.par=NULL)
|
rate.cat |
specifies the number of rate categories in the HRM. |
hrm |
a logical indicating whether the underlying model is the hidden rates model (HRM). The default is |
ntraits |
specifies the number of traits in the data file if the underlying model is not the HRM. |
nstates |
specifies the number of characters in the data file used in rayDISC. |
model |
if the model is not HRM, specifies the underlying model. |
rate.mat.index |
A user-supplied rate matrix index to be manipulated. |
drop.par |
a vector of transitions to be dropped from the model. Use |
eq.par |
a vector of transitions pairs to be set equal. Use |
Outputs the full index of the rate parameters that are to be optimized. The intention is that a user might want to see how the matrix is designed prior to an analysis and perhaps drops a few parameters beforehand due to some hypothesis that he or she might have. The resulting matrix can then be plugged directly into corHMM, corDISC, or rayDISC.
Returns a rate matrix index
Jeremy M. Beaulieu and Jeffrey C. Oliver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #Generate a matrix for two binary traits:
rate.mat<-rate.mat.maker(hrm=FALSE,ntraits=2,model="ARD")
#Drop parameter 8 from the model
rate.mat<-rate.par.drop(rate.mat, drop.par=c(8))
#Set parameters 1 and 2 equal to one another:
rate.mat<-rate.par.eq(rate.mat, eq.par=c(1,2))
#Precursor model. There are many ways to do this, but here is one way
rate.mat<-rate.mat.maker(hrm=TRUE,rate.cat=2)
rate.mat<-rate.par.drop(rate.mat,c(1,3,4,6,7,8))
rate.mat<-rate.par.eq(rate.mat,c(1,2))
#Now add in a couple more connections:
rate.mat[3,2]<-1
rate.mat[2,3]<-1
#Now just use this matrix when using the corHMM function
#Here is a one way of doing a more complicated precursor:
rate.mat[3,2]<-2
rate.mat[1,3]<-3
rate.mat[2,3]<-4
#Again, just use this matrix when using the corHMM function
#Finally, here is an easier way of doing the precursor:
rate.mat<-rate.mat.maker(hrm=TRUE,rate.cat=2)
rate.mat<-rate.par.drop(rate.mat,c(1,3,4,7))
rate.mat[!is.na(rate.mat)]<-1
#Not run
# pp<-corHMM(primates$tree,primates$trait,rate.cat=2,rate.mat=rate.mat,
# node.states="marginal",diagn=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.