Qualitative structure of a discrete-time Markov chain
Source:R/chain_structure.R
chain_structure.RdComputes 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.
Arguments
- x
A
netobject,cograph_network,tnamodel, transition matrix, or sequence data.frame (passed throughbuild_network()withmethod = "relative").- normalize
Logical. If
TRUE(default), rows of the transition matrix are renormalized to sum to 1 before analysis (seepassage_time()for the same convention).- tol
Numerical tolerance for the reversibility check (detailed balance) and for treating near-zero entries as zero when building the support graph (which drives
classification,communicating_classes,period, andhitting_probabilities). It does not govern the absorbing-state test: a state is absorbing only whenP[i, i]equals 1 to an internal fixed tolerance of.Machine$double.eps^0.5, independent oftol(so raisingtolto ignore tiny transition probabilities never reclassifies a near-deterministic state as absorbing). Default1e-10.
Value
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_classesthat 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-facingtoldoes not relax this).periodNamed integer vector. Period of each recurrent state;
NAfor transient states.is_irreducibleLogical.
TRUEiff there is exactly one communicating class.is_aperiodicLogical.
TRUEiff every recurrent state has period 1.is_regularLogical.
is_irreducible && is_aperiodic.is_reversibleLogical or
NA.TRUEiff the chain satisfies detailed balance against its stationary distribution.NAfor non-irreducible chains (no unique stationary).hitting_probabilitiesn x nmatrix.[i, j] = P(ever reach j starting from i), computed over the sametol-thresholded support graph that drivesclassificationso the two are mutually consistent (a state classified"absorbing"/closed never shows hitting probability to states outside its class).absorption_probabilitiesn_transient x n_absorbingmatrix orNULLif 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.
Details
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).
References
Kemeny, J. G. and Snell, J. L. (1976). Finite Markov Chains. Springer-Verlag.
Norris, J. R. (1997). Markov Chains. Cambridge University Press.
Examples
net <- build_network(as.data.frame(trajectories), method = "relative")
cs <- chain_structure(net)
print(cs)
#> Chain structure [3 states, 1 communicating classes]
#> irreducible: TRUE aperiodic: TRUE regular: TRUE reversible: FALSE
#> recurrent classes: 1 transient classes: 0
#>
#> Use summary(x) for the per-state table, plot(x) for the heatmap.
# \donttest{
summary(cs)
#> Chain structure summary [3 states, 1 classes]
#> irreducible: TRUE aperiodic: TRUE regular: TRUE reversible: FALSE
#>
#> state classification period persistence return_probability sojourn_steps
#> Active recurrent 1 0.6976 1 3.31
#> Average recurrent 1 0.6099 1 2.56
#> Disengaged recurrent 1 0.4831 1 1.93
#> stationary_probability
#> 0.3719
#> 0.4431
#> 0.1850
# }