generator_functions: The phase-type distribution

Description Usage Arguments Details Value Functions Examples

Description

Generator functions for the S3 classes cont_phase_type, disc_phase_type, mult_cont_phase_type, mult_disc_phase_type, which represent the different phase-type distributions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
PH(subint_mat = NULL, init_probs = NULL, round_zero = NULL)

DPH(subint_mat = NULL, init_probs = NULL, round_zero = NULL)

MPH(subint_mat = NULL, init_probs = NULL,
    reward_mat = NULL, round_zero = NULL)

MDPH(subint_mat = NULL, init_probs = NULL,
     reward_mat = NULL, round_zero = NULL)

## S3 method for class 'cont_phase_type'
summary(object, ...)

## S3 method for class 'disc_phase_type'
summary(object, ...)

## S3 method for class 'mult_cont_phase_type'
summary(object, ...)

## S3 method for class 'mult_disc_phase_type'
summary(object, ...)

Arguments

subint_mat

a square matrix containing the transition rates or probabilities between transient states for continuous or discrete phase-type respectively. If the phase-type is continuous, the sub-intensity matrix diagonal should only contain negative values and the row sums should be non-positive. If the phase-type is discrete, the sub-intensity matrix should only contain 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 0 otherwise.

round_zero

an integer or NULL(default), which gives the decimal from which we should truncate the positive values of the sub-intensity 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.s

reward_mat

a matrix NULL(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.

object

a phase-type object

...

other arguments passed to methods

Details

PH, DPH, MPH and MDPH are the generator functions for the four types of phase-type distribution classes, this is, the continuous univariate, the discrete univariate, the continuous multivariate and the discrete multivariate respectively. 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.

Value

A phase-type object of class cont_phase_type for PH, disc_phase_type for DPH, mult_cont_phase_type for MPH, and mult_disc_phase_type for MDPH. All these classes inherit from list.

Functions

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
##===========================##
## For continuous univariate ##
##===========================##

subintensity_matrix <- matrix(c(-1.5, 1.5, 0,
                                 0,  -1,   1,
                                 0,   0,  -0.5),
                              ncol = 3,
                              byrow = TRUE)
PH(subintensity_matrix)

#---

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


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

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

#---

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



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

subintensity_matrix <- matrix(c(-3,  2,  0,
                                 0, -2,  1,
                                 0,  0, -1),
                              nrow = 3,
                              byrow = TRUE)
reward_matrix = matrix(sample(seq(0, 10, 0.1), 6), nrow = 3, ncol = 2)
initial_probabilities = c(1, 0, 0)
MPH(subintensity_matrix,
    initial_probabilities,
    reward_matrix)


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

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

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