| hittingProbabilities | R Documentation |
Given a markovchain object, this function calculates the probability of ever arriving from state i to j
hittingProbabilities(object, targets = NULL,
solver = c("direct", "bicgstab", "doubling"), tol = 1e-13, maxIter = 200)
object |
the markovchain-class object |
targets |
optional character vector of state names: only the hitting
probabilities towards these states are computed. The default,
|
solver |
the method used to solve the linear system
|
tol |
relative residual at which the iterative solvers
( |
maxIter |
maximum number of iterations of the iterative solvers: the
number of BiCGSTAB steps, or the number of squarings of the doubled Neumann
series. A warning is raised, and the current values returned, if the
requested |
On each target the states are first split by graph reachability:
a state that cannot reach the target has probability zero, and one that can
reach the target but no closed class outside it has probability one. Only
the remaining states need the linear system that solver controls, so
on chains where that split already decides every state (an irreducible
chain, for instance) all three solvers do the same negligible amount of
work. The choice matters on chains with several closed classes, i.e. on
genuine absorption probabilities.
a matrix of hitting probabilities. Entry [i, j] is the
probability of ever arriving from state i to state j (the
probability of returning, after at least one transition, on the diagonal);
for a chain with byrow = FALSE the matrix is transposed, as the
transition matrix is. With targets, only the columns (rows if
byrow = FALSE) of the targets are returned, in the order given, and
they coincide with those of the full matrix.
Ignacio Cordón
R. Vélez, T. Prieto, Procesos Estocásticos, Librería UNED, 2013
H. A. van der Vorst (1992). Bi-CGSTAB: A Fast and Smoothly Converging Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems. SIAM Journal on Scientific and Statistical Computing, 13(2), 631-644.
M <- markovchain:::zeros(5)
M[1,1] <- M[5,5] <- 1
M[2,1] <- M[2,3] <- 1/2
M[3,2] <- M[3,4] <- 1/2
M[4,2] <- M[4,5] <- 1/2
mc <- new("markovchain", transitionMatrix = M)
hittingProbabilities(mc)
# only the probabilities of ever reaching the first state
hittingProbabilities(mc, targets = "1")
# on a large sparse chain, the iterative solver avoids the dense products
hittingProbabilities(mc, targets = "1", solver = "bicgstab")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.