Skip to contents

htna-named alias of Nestimate::markov_order_test(). Tests whether a first-order Markov model is adequate for the observed sequences, or whether a higher order is required, by comparing the empirical transition structure against orders 1..max_order via permutation.

Usage

markov_order_test_htna(data, ...)

Arguments

data

Raw sequence data: a list of character vectors or a wide-format data frame. See Nestimate::markov_order_test().

...

Additional arguments passed to Nestimate::markov_order_test(), such as max_order, n_perm, alpha, parallel, n_cores, and seed. See that function for the full, current argument list.

Value

An object of class markov_order_test with components test_table, optimal_order, and the inputs. See Nestimate::markov_order_test() for full details and the corresponding plot() method.

Details

Operates on raw sequence data (a list of character vectors or a wide-format data frame), not on an htna network object. Use alongside reliability_htna() and casedrop_reliability_htna() when assessing whether a Markov-1 transition network is appropriate before trusting downstream htna analyses.

Suffixed _htna to avoid clashing with Nestimate::markov_order_test() when both packages are loaded.

Examples

# \donttest{
data(human_ai)
net <- build_htna(human_ai, actor_type = "actor_type")
#> Warning: A network with one long sequence is not recommended and can't be validated using bootstrap and other confirmatory testings.
#> Metadata aggregated per session: ties resolved by first occurrence in 'session_date' (1 sessions), 'cluster' (42 sessions), 'actor_type' (24 sessions)
markov_order_test_htna(net$data, max_order = 2, n_perm = 50, seed = 1)
#> Markov Order Test  [within-w permutation, n_perm = 50, alpha = 0.050]
#>   428 sequences / 19346 observations / 12 states
#> 
#>   Selected order  BIC: 1   AIC: 2   permutation-LRT: 2
#> 
#>  order    loglik      AIC      BIC   df       g2 p_permutation p_asymptotic
#>      0 -43741.91 87505.83 87592.40   NA       NA            NA           NA
#>      1 -37315.96 74899.92 75954.53  121 12815.99    0.01960784            0
#>      2 -33812.56 69739.12 78057.97 1272  6481.76    0.01960784            0
#>  significant
#>           NA
#>         TRUE
#>         TRUE
# }