View source: R/chain_structure.R
| chain_structure | R Documentation |
Computes properties that depend only on the transition matrix support, not on any starting distribution: state classification, communicating classes, periods, irreducibility / aperiodicity / regularity / reversibility, hitting probabilities, and absorption analysis when absorbing states exist.
chain_structure(x, normalize = TRUE, tol = 1e-10)
x |
A |
normalize |
Logical. If |
tol |
Numerical tolerance for the reversibility check (detailed
balance) and for treating near-zero entries as zero when building the
support graph (which drives |
Built specifically as a diagnostic to run before trusting the output
of passage_time() or markov_stability(). Both implicitly assume a
regular chain (irreducible + aperiodic) so that the stationary
distribution is unique and meaningful. Use is_regular to check.
The fundamental-matrix absorption math follows Kemeny & Snell (1976); the hitting-probability linear system follows Norris (1997).
A chain_structure object: a list with elements
statesCharacter vector of state names.
classificationNamed character vector. One of "absorbing",
"recurrent", "transient" per state.
communicating_classesList of state-name vectors. Each sublist is a strongly connected component of the support graph.
recurrent_classesSubset of communicating_classes that are
closed (no transitions leaving the class).
transient_classesSubset that are not closed.
absorbing_statesCharacter vector of states with P[i, i] = 1
(tested exactly, to within .Machine$double.eps^0.5; the
user-facing tol does not relax this).
periodNamed integer vector. Period of each recurrent state;
NA for transient states.
is_irreducibleLogical. TRUE iff there is exactly one
communicating class.
is_aperiodicLogical. TRUE iff every recurrent state has
period 1.
is_regularLogical. is_irreducible && is_aperiodic.
is_reversibleLogical or NA. TRUE iff the chain
satisfies detailed balance against its stationary distribution.
NA for non-irreducible chains (no unique stationary).
hitting_probabilitiesn x n matrix. [i, j] = P(ever reach j starting from i), computed over the same tol-thresholded support
graph that drives classification so the two are mutually
consistent (a state classified "absorbing"/closed never shows
hitting probability to states outside its class).
absorption_probabilitiesn_transient x n_absorbing matrix
or NULL if no transient -> absorbing pathway exists. [i, j] = P(eventual absorption in j | start in i).
mean_absorption_timeNamed numeric vector or NULL. Expected
number of steps until absorption from each transient state.
PThe (possibly normalized) transition matrix used.
Kemeny, J. G. and Snell, J. L. (1976). Finite Markov Chains. Springer-Verlag.
Norris, J. R. (1997). Markov Chains. Cambridge University Press.
passage_time(), markov_stability(), build_network()
net <- build_network(as.data.frame(trajectories), method = "relative")
cs <- chain_structure(net)
print(cs)
summary(cs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.