print.dtmc: Show the Properties of the Markov Chain

Description Usage Arguments Author(s) Examples

View source: R/print.dtmc.R

Description

Print the name, states, dimension and transition matrix of Markov Chain

Usage

1
2
3
4
## S3 method for class 'dtmc'
print(x, ...)
## S3 method for class 'ctmc'
print(x, ...)

Arguments

x

the Markov Chain we want to apply

...

Arguments to be passed to methods

Author(s)

Jiexuan Cao, Yuki Liu, Qianhan Zhang

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
dtftmc = mc(states = c("sunny", "cloudy", "rain"),
                 pijdef = function(i,j,...) {
                           if (i == 1 && j < 3 ||
                               i == 2 && j != 2 ||
                               i == 3 && j > 1)  return(0.5)
                           0
                        },  
       name = "Weather")

dtftmc
dtftmc$states
dtftmc$pijdef

pijdeffunction = function(i,j) {
    p = 0.3
    q = 0.7
    r = 0
    if (i == 1 && j == 1)
        return (1 - p)
    if(j == i + 1)
        return(p)
    if(j == i - 1)
        return(q)
    if(j==i)
        return(r)
    return(0)
}

dtiftmc = mc(states = "infinity",
             pijdef = pijdeffunction, 
             name = "death and birth")

dtiftmc
dtiftmc$states
dtiftmc$pijdef

yuki0425/mc documentation built on May 4, 2019, 7:44 p.m.