markov_stability: Markov Stability Analysis

View source: R/markov.R

markov_stabilityR Documentation

Markov Stability Analysis

Description

Computes per-state stability metrics from a transition network: persistence (self-loop probability), stationary distribution, mean recurrence time, sojourn time, and mean accessibility to/from other states.

Usage

markov_stability(x, normalize = TRUE)

## S3 method for class 'net_markov_stability'
plot(
  x,
  metrics = c("persistence", "stationary_prob", "return_time", "sojourn_time",
    "avg_time_to_others", "avg_time_from_others"),
  ...
)

Arguments

x

A netobject, cograph_network, tna object, row-stochastic numeric transition matrix, or a wide sequence data.frame (rows = actors, columns = time-steps).

normalize

Logical. Normalize rows to sum to 1? Default TRUE.

metrics

Character vector. Which metrics to plot. Options: "persistence", "stationary_prob", "return_time", "sojourn_time", "avg_time_to_others", "avg_time_from_others". Default: all six.

...

Ignored.

Details

Sojourn time is the expected consecutive time steps spent in a state before leaving: 1/(1-P_{ii}). States with persistence = 1 have sojourn_time = Inf.

avg_time_to_others: mean passage time from this state to all others; reflects how "sticky" or "isolated" the state is.

avg_time_from_others: mean passage time from all other states to this one; reflects accessibility (attractor strength).

Value

An object of class "net_markov_stability" with:

stability

Data frame with one row per state and columns: state, persistence (P_{ii}), stationary_prob (\pi_i), return_time (1/\pi_i), sojourn_time (1/(1-P_{ii})), avg_time_to_others (mean MFPT leaving state i), avg_time_from_others (mean MFPT arriving at state i).

mpt

The underlying net_mpt object.

See Also

passage_time

Examples

net <- build_network(as.data.frame(trajectories), method = "relative")
ms  <- markov_stability(net)
print(ms)

plot(ms)



Nestimate documentation built on April 20, 2026, 5:06 p.m.