Tables of a Markov stability analysis
Source:R/memory_markov_stability.R
hg_get.net_markov_stability.RdTables of a Markov stability analysis
Arguments
- x
A
net_markov_stabilityobject fromhg_markov_stability().- what
Which table:
"states"(default, one row per state),"passage_time"(one row per ordered pair of states) or"stationary"(one row per state, distribution only).- ...
Ignored.
- sort_by
NULL(construction order, the default) or a column name of the selected table.- decreasing
Logical. Sort
sort_byfrom largest to smallest (TRUE, the default) or smallest to largest (FALSE). Ties are broken by the row key, ascending in both directions:state, orfromthentofor the passage table.- from, to
NULL(default, every state) or a character vector of states. Restrict thewhat = "passage_time"table to passages leaving thefromstates and arriving at thetostates. Only that table hasfrom/tocolumns; using either with anotherwhat, or naming a state the chain does not have, raiseshypernets_bad_input.- top
Integer or
NULL. Keep only the firsttoprows, applied last: afterwhat,from/toandsort_by.
Value
A base data.frame. For what = "states", one row per state with
state, persistence, stationary, return_time,
sojourn_time, avg_time_to_others and avg_time_from_others, as
the estimator stores them (probabilities rounded to 4 decimals, times to 2). For
what = "passage_time", one row per ordered pair with from, to and
steps. For what = "stationary", one row per state with state,
stationary and return_time; the passage and stationary tables
are unrounded.
Examples
P <- matrix(c(0.5, 0.3, 0.2,
0.2, 0.5, 0.3,
0.1, 0.4, 0.5), 3, 3, byrow = TRUE,
dimnames = list(c("A", "B", "C"), c("A", "B", "C")))
ms <- hg_markov_stability(P)
hg_get(ms, sort_by = "stationary")
#> state persistence stationary return_time sojourn_time avg_time_to_others
#> 1 B 0.5 0.4182 2.39 2 4.92
#> 2 C 0.5 0.3455 2.89 2 4.77
#> 3 A 0.5 0.2364 4.23 2 3.63
#> avg_time_from_others
#> 1 2.83
#> 2 3.95
#> 3 6.54
hg_get(ms, what = "passage_time", from = "A")
#> from to steps
#> 1 A A 4.230769
#> 2 A B 3.043478
#> 3 A C 4.210526
hg_get(ms, what = "stationary")
#> state stationary return_time
#> 1 A 0.2363636 4.230769
#> 2 B 0.4181818 2.391304
#> 3 C 0.3454545 2.894737