The sum of two independent discrete or continuous phase-type distributed variables with initial distributions initDist1 and initDist2 as well as sub-transition/sub-intensity matrices equal to P_Mat1/T_Mat1 and P_Mat2/T_Mat2.

phsum(object1, object2)

Arguments

object1, object2

two objects of class discphasetype or contphasetype for which the sum should be computed.

Source

Mogens Bladt and Bo Friis Nielsen (2017): Matrix-Exponential Distributions in Applied Probability. Probability Theory and Stochastic Modelling (Springer), Volume 81.

Value

The function phsum returns an object of type discphasetype or contphasetype (depending on the input) holding the phase-type representation of the sum of the input objects.

Details

In the discrete case, the sum of two phase-type distributed variables \(tau1 ~ DPH_p(\alpha,S)\) and \(tau2 ~ DPH_q(\beta,T)\) is again discrete phase-type distributed in the following way $$tau1 + tau2 ~ DPH_{p+q}((\alpha,0),cbind((S, s \beta),(0,T)) ).$$ In the continuous case, the sum of two phase-type distributed variables \(X ~ PH_p(\alpha,S)\) and \(Y ~ PH_q(\beta,T)\) is again continuous and phase-type distributed in the following way $$X + Y ~ PH_{p+q}((\alpha,0),cbind((S, s \beta),(0,T)) ).$$

See also

Examples

## A simple example phsum(T_MRCA$n5,T_Total$n5)
#> $initDist #> [1] 1 0 0 0 0 0 0 0 #> #> $T_Mat #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] #> [1,] -10 10 0 0 0 0.0 0.0 0.0 #> [2,] 0 -6 6 0 0 0.0 0.0 0.0 #> [3,] 0 0 -3 3 0 0.0 0.0 0.0 #> [4,] 0 0 0 -1 1 0.0 0.0 0.0 #> [5,] 0 0 0 0 -2 2.0 0.0 0.0 #> [6,] 0 0 0 0 0 -1.5 1.5 0.0 #> [7,] 0 0 0 0 0 0.0 -1.0 1.0 #> [8,] 0 0 0 0 0 0.0 0.0 -0.5 #> #> attr(,"class") #> [1] "contphasetype"
## For n=4, the total length of branches giving rise to ## singletons is phase-type distributed with initial distribution initDist1 <- c(1,0,0) ## and sub-intensity rate matrix T_Mat1 <- matrix(c(-1.5, 1.5, 0, 0, -1.5, 1, 0, 0, -1), nrow = 3, byrow = TRUE) ## The total length of branches giving rise to ## double-tons is phase-type distributed with initial distribution initDist2 <- c(1,0) ## and sub-intensity rate matrix T_Mat2 <- matrix(c(-3, 1, 0, -0.5), nrow = 2, byrow = TRUE) ## Defining two objects of type "contphasetype" T1 <- contphasetype(initDist1, T_Mat1) T2 <- contphasetype(initDist2, T_Mat2) ## Hence, the total length of branches giving rise to ## singletons and doubletons is phase-type distributed ## in the following way phsum(T1,T2)
#> $initDist #> [1] 1 0 0 0 0 #> #> $T_Mat #> [,1] [,2] [,3] [,4] [,5] #> [1,] -1.5 1.5 0 0.0 0.0 #> [2,] 0.0 -1.5 1 0.5 0.0 #> [3,] 0.0 0.0 -1 1.0 0.0 #> [4,] 0.0 0.0 0 -3.0 1.0 #> [5,] 0.0 0.0 0 0.0 -0.5 #> #> attr(,"class") #> [1] "contphasetype"
## (Please compare this distribution with the distribution ## obtained directly from the reward transformation)