phase_type: Generator Function for Phase-Type Distributions

Description Usage Arguments Details Examples

View source: R/phase_type.R

Description

Description of the S3 classes cont_phase_type, disc_phase_type, mult_cont_phase_type, mult_disc_phase_type which represents the different phase-type distributions.

Usage

1
2
phase_type(subint_mat = NULL, init_probs = NULL, reward_mat = NULL,
                  round_zero = NULL)

Arguments

subint_mat

is the square matrix containing the transition rates or probabilities between transient states for continous or discrete phase-type respectively. If the phase-type is continuous, the subintensity matrix diagonal should only contains negative values and the row sums should be non-positive. If the phase-type is discrete, the subintensity matrix should only contains values between 0 and 1.

init_probs

a vector, a one-row matrix or NULL which gives the probabilities to start in each state. If init_probs is NULL, the probability to start on the first state will be 1 and to start on any other state 0.

reward_mat

is a matrix codeNULL(default) where each row is a reward vector, and each column corresponds to a state. It should have the same number of columns as the length of the initial probabilities.

round_zero

is an integer or NULL(default), which gives the decimal from which we should truncate the positive values of the subintensity matrix. It could be useful in the scenarios where there is a reward transformation leading to values with many decimals and potentially computational approximation and potentially to positive row sums in continuous phase-type .

Details

phase_type is the generator function for the four types of phase-type classes, respectively univariate continuous or discrete and multivariate continuous or discrete which inherits from list. The class is generated by supplying a sub-intensity matrix and an optional initial probability vector plus a reward matrix in the case of multivariate phase-type. If the initial probabilities are not specified, then the initial probability will be init_probs = c(1, 0, 0, ...) with the same length as the number of transient states.

Examples

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
##===========================##
## For continuous univariate ##
##===========================##

subintensity_matrix <- matrix(c(-1.5, 0, 0,
                               1.5, -1, 0,
                               0, 1, -0.5), ncol = 3)
phase_type(subintensity_matrix)

#---

subintensity_matrix <- matrix(c(-1.5, 0, 0,
                               1.5, -1, 0,
                               0, 1, -0.5), ncol = 3)
initial_probabilities <- c(0.9, 0.1, 0)
phase_type(subintensity_matrix, initial_probabilities)

##=========================##
## For discrete univariate ##
##=========================##

subintensity_matrix <- matrix(c(0.4, 0, 0,
                               0.24, 0.4, 0,
                               0.12, 0.2, 0.5), ncol = 3)
phase_type(subintensity_matrix)

#---

subintensity_matrix <- matrix(c(0.4, 0, 0,
                               0.24, 0.4, 0,
                               0.12, 0.2, 0.5), ncol = 3)
initial_probabilities <- c(0.9, 0.1, 0)
phase_type(subintensity_matrix, initial_probabilities)

##=============================##
## For continuous multivariate ##
##=============================##

subintensity_matrix <- matrix(c(-3, 0, 0,
                               2, -2, 0,
                               0, 1, -1), nrow = 3, ncol = 3)
reward_matrix = matrix(sample(seq(0, 10, 0.1), 6), nrow = 3, ncol = 2)
phase_type(subintensity_matrix, reward_mat = reward_matrix)

##===========================##
## For discrete multivariate ##
##===========================##

subintensity_matrix <- matrix(c(0.4, 0, 0,
                               0.24, 0.4, 0,
                               0.12, 0.2, 0.5), ncol = 3)
reward_matrix <- matrix(sample(seq(0, 10), 6), nrow = 3, ncol = 2)
phase_type(subintensity_matrix, reward_mat = reward_matrix)

rivasiker/phasty documentation built on June 15, 2021, 9:18 p.m.