Constructing phase-type representations
discphasetype(initDist, P_Mat) contphasetype(initDist, T_Mat)
| initDist | a vector holding the initial distribution of the phase-type
distribution. Hence |
|---|---|
| P_Mat | A sub-transition probability matrix satisfying that all entries
are non-negative. Furthermore, |
| T_Mat | A sub-intensity rate matrix. The matrix must be invertible, all diagonal
entries must be negative and all non-diagonal entries must be non-negative. Also for each
row the sum of the entries must be non-positive.
Furthermore, the length of the initial distribution has to be
equal to the number of rows and number of columns of |
discphasetype returns a list of class "discphasetype", while
contphasetype returns a list of class "contphasetype". Both lists
hold
initDist : The initial distribution
P_Mat/T_Mat : The sub-transition/sub-intensity matrix
discphasetype creates an object of class "discphasetype", i.e. the
object represents a discrete phase-type distribution.
contphasetypecreates an object of class "contphasetype", i.e. the
object represents a continuous phase-type distribution.
discphasetype: Creating an object of type discphasetype
contphasetype: Creating an object of type contphasetype
## For n=4, the time to the most recent common ancestor is ## phase-type distributed with ## initial distribution initDist <- c(1,0,0) ## and sub-intensity rate matrix T_Mat <- matrix(c(-6,6,0, 0,-3,3, 0,0,-1), nrow = 3, ncol = 3, byrow = TRUE) TMRCA <- contphasetype(initDist, T_Mat) ## For theta=2, the number of segregating sites plus one is ## discrete phase-type distributed with ## initial distribution initDist <- c(1,0,0,0) ## and sub-transition probability matrix P_Mat <- matrix(c(0.4, 0.3, 4/30, 2/30, 0, 0.5, 2/9, 1/9, 0, 0, 2/3, 0, 0, 0, 0, 2/3), nrow = 4, ncol = 4, byrow = TRUE) S_Total <- discphasetype(initDist, P_Mat)