sim_phase_type: Phase-type simulations

Description Usage Arguments Examples

View source: R/simul.R

Description

sim_phase_type implements a naive simulation scheme for simulation of phase-type distributions.

Usage

1
sim_phase_type(obj, R = 100)

Arguments

obj

an object of class disc_phase_type or cont_phase_type

R

Number of replications

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
##===========================##
## For continuous univariate ##
##===========================##

set.seed(2)
subintensity_matrix <- matrix(c(-1.5, 0, 0.5,
                               1.5, -1, 0,
                               0, 1, -1), ncol = 3)
obj <- PH(subintensity_matrix)

sim_phase_type(obj)

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

set.seed(2)
subintensity_matrix <- matrix(c(0.4, 0, 0.1,
                               0.24, 0.6, 0.3,
                               0.26, 0.4, 0.5), ncol = 3)
obj <- DPH(subintensity_matrix)

sim_phase_type(obj)

##=============================##
## 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)
obj <- MPH(subintensity_matrix, reward_mat = reward_matrix)
sim_phase_type(obj)

##===========================##
## 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)
MDPH(subintensity_matrix, reward_mat = reward_matrix)

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