Description Usage Arguments Value See Also Examples
calc_reverse_markov_gen
returns the generator matrix of the Markov chain which is the time-reversed process of a given Markov chain.
1 | calc_reverse_markov_gen(num_states, behav_params)
|
num_states |
Numeric, number of (behavioural) states in the Markov chain. |
behav_params |
List with components:
|
List with the components:
times
Vector, switching times of the simulation. Includes the fixed end points.
states
Vector, states at switching times of the simulation. Includes the fixed end points.
calc_markov_steady_state
for calculating a Markov steady state/equilibrium distribution and
sim_markov_backward
for simulating from this reverse-time process.
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 | # In a two state process, the reverse chain is equal to the forward chain
num_states <- 2
behav_params <- list(lambda = c(0.1,0.2),
q = matrix(c(NA,1,1,NA), nrow = 2))
calc_reverse_markov_gen(num_states, behav_params)
# $lambda
# [1] 0.1 0.2
#
# $q
# [,1] [,2]
# [1,] NA 1
# [2,] 1 NA
num_states <- 3
behav_params <- list(lambda = c(0.1,0.2,0.3),
q = matrix(c(NA,0.15/0.2,0.05/0.3,0.05/0.1,NA,0.25/0.3,0.05/0.1,0.05/0.2,NA),nrow=3))
calc_reverse_markov_gen(num_states, behav_params)
# $lambda
# [1] 0.1 0.2 0.3
#
# $q
# [,1] [,2] [,3]
# [1,] NA 0.8684211 0.1315789
# [2,] 0.4318182 NA 0.5681818
# [3,] 0.6333333 0.3666667 NA
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.