Functions for stochastic matrix modifications.

teleport(teleport_prob = 0.15)

vote_equal(stoch)

vote_self(stoch)

Arguments

teleport_prob

Probability of 'teleportation'.

stoch

Input stochastic matrix.

Value

teleport() returns a modifier function.

vote_equal() and vote_self() are modifier functions and return modified version of input stochastic matrix.

Details

Modification logic behind teleport() assumes that at each step of Markov chain (described by column-stochastic matrix) the decision is made whether to change state according to stochastic matrix or to 'teleport' to any state with equal probability. Probability of 'teleport' is teleport_prob. This modification is useful because it ensures irreducibility of stochastic matrix (with teleport_prob in (0; 1)). Note that in order to obtain modifier one should call function teleport() with some parameter.

vote_equal() and vote_self() modify columns with elements only equal to 0. The former fills them with 1/nrow(stoch) and the latter changes only the respective diagonal element to 1. This is equivalent to jump to any state with equal probability and to stay in the current state respectively.

Examples

input_stoch <- matrix(c(0, 0.3, 0, 0.7), ncol = 2, byrow = TRUE) teleport(0.15)(input_stoch)
#> [,1] [,2] #> [1,] 0.5 0.33 #> [2,] 0.5 0.67
vote_equal(input_stoch)
#> [,1] [,2] #> [1,] 0.5 0.3 #> [2,] 0.5 0.7
vote_self(input_stoch)
#> [,1] [,2] #> [1,] 1 0.3 #> [2,] 0 0.7