Hey folks,
There are a few ways to approach this issue. The one we usually use in my lab is to separate out the unordered characters and partition them by number of states (as in this
tutorial). Then the ordered characters, we separate by maxstate and ordering.
So, for instance, if you had three ordered characters with number of states 4, 5 and 6 in a three character matrix, this would look something like this:
lambda = 1
mu = 1
morpho <- readDiscreteCharacterData("myfile")
vector_morph[1] <- morpho
vector_morph[1].excludeCharacters(2,3)
vector_morph[2].excludeCharacters(1,3)
vector_morph[3].excludeCharacters(1,2)
Q_o1 <- fnOrderedRateMatrix(4, lambda, mu)
Q_o2 <- fnOrderedRateMatrix(5, lambda, mu)
Q_o3 <- fnOrderedRateMatrix(6, lambda, mu)
morph_models[1] ~ dnPhyloCTMC(tree=phylogeny, siteRates=rates_morpho,
Q=Q_o1, type="Standard")
morph_models[2] ~ dnPhyloCTMC(tree=phylogeny, siteRates=rates_morpho,
Q=Q_o2, type="Standard")
morph_models[3] ~ dnPhyloCTMC(tree=phylogeny, siteRates=rates_morpho,
Q=Q_o3, type="Standard")
morph_models[1].clamp(vector_morph[1])
morph_models[2].clamp(vector_morph[2])
morph_models[3].clamp(vector_morph[3])
I'm sure there's a way to make that a nice iterable. But I can't think of it just now. A member of my lab is working on some companion R functions to automate this type of partitioning, and working on importing some additional functionality from the NCL reader library to make RevBayes do this more naturally.
a