q_doubletrans: Basic Qmatrix

Description Usage Arguments Value Examples

View source: R/secsse_utils.R

Description

Sets a Q matrix where double transitions are not allowed

Usage

1
q_doubletrans(traits, masterBlock, diff.conceal)

Arguments

traits

vector with trait states, order of states must be the same as tree tips, for help, see vignette.

masterBlock

matrix of transitions among only examined states, NA in the main diagonal, used to build the full transition rates matrix.

diff.conceal

should the concealed states be different? Normally it should be FALSE.

Value

Q matrix that includes both examined and concealed states, it should be declared as the third element of idparslist.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
traits <- sample(c(0,1,2), 45,replace = TRUE) #get some traits
masterBlock <- matrix(99,ncol = 3,nrow = 3,byrow = TRUE) #For a three-state trait
diag(masterBlock) <- NA
masterBlock[1,2] <- 6
masterBlock[1,3] <- 7
masterBlock[2,1] <- 8
masterBlock[2,3] <- 9
masterBlock[3,1] <- 10
masterBlock[3,2] <- 11
myQ <- q_doubletrans(traits,masterBlock,diff.conceal = FALSE)
# now, it can replace the Q matrix from id_paramPos  
num_concealed_states <- 3 
param_posit <- id_paramPos(traits,num_concealed_states)
param_posit[[3]] <- myQ

secsse documentation built on July 16, 2021, 9:06 a.m.