Skip to contents

A two-panel visualization (the plot of Nestimate::markov_order_test()):

Usage

# S3 method for class 'tna_markov_order'
plot(x, panel = "both", combined = TRUE, title = NULL, ...)

# S3 method for class 'group_tna_markov_order'
plot(x, panel = "both", combined = TRUE, title = names(x), ...)

Arguments

x

A tna_markov_order or a group_tna_markov_order object.

panel

A character string, which panels to draw: "both" (the default), "ic", or "permutation".

combined

A logical value. When panel = "both" and combined is TRUE (the default), the two panels are drawn side by side. When FALSE, the two ggplot objects are returned without drawing them. Ignored when panel is not "both".

title

An optional character string placed before the panel titles. For a group_tna_markov_order object, one per group (the group names by default).

...

Must be empty: an unknown argument, such as a misspelled panel, is an error.

Value

A ggplot object for panel = "ic" or panel = "permutation". For panel = "both", a named list of the two ggplot objects (ic, permutation), invisibly, after drawing them side by side when combined = TRUE. For a group_tna_markov_order object, the plots of the groups are drawn one after another, and a list with the result for each group is returned invisibly.

Details

  • Panel A: the log-likelihood, AIC, and BIC across the tested orders, with the order selected by the permutation tests (dashed line) and the order that minimizes BIC (dotted line) marked.

  • Panel B: the permutation null density of each order with the observed \(G^2\) as a vertical line, colored by rejection at level and labelled with its p-value.

Uses the Okabe-Ito colorblind-safe palette.

Examples

model <- tna(group_regulation)
mo <- markov_order(model, max_order = 2, iter = 50)
plot(mo)

plot(mo, panel = "ic")