% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/markov_order.R
\name{plot.net_markov_order}
\alias{plot.net_markov_order}
\title{Plot Method for net_markov_order}
\usage{
\method{plot}{net_markov_order}(x, panel = c("both", "ic", "permutation"), combined = TRUE, ...)
}
\arguments{
\item{x}{A \code{net_markov_order} object.}

\item{panel}{Which panel(s) to render: \code{"both"}, \code{"ic"},
or \code{"permutation"}. Default \code{"both"}.}

\item{combined}{When \code{panel = "both"} and \code{combined = TRUE}
(default), the two panels are drawn side-by-side. If \pkg{gridExtra}
is installed they are arranged into a single drawable/saveable
gtable (returned); otherwise base \code{grid} viewports draw both
panels and a named list of the two ggplots is returned invisibly.
When \code{FALSE}, returns that named list (\code{ic},
\code{permutation}) without drawing. Ignored when
\code{panel != "both"}.}

\item{...}{Ignored.}
}
\value{
A ggplot (single panel); for \code{panel = "both"}, either a
\code{gridExtra} gtable (when \pkg{gridExtra} is installed) or a
named list of two ggplots (\code{ic}, \code{permutation}) drawn
side-by-side and returned invisibly.
}
\description{
Two-panel professional visualization:
\itemize{
\item Panel A: log-likelihood, AIC, BIC across tested orders with
the selected order highlighted (both the permutation-selected
order and the BIC-minimizing order are marked).
\item Panel B: permutation null density per order with the observed
\eqn{G^2} as a vertical marker; colored by rejection at
\code{alpha}.
}
Uses the Okabe-Ito colorblind-safe palette.
}
\examples{
\donttest{
# First-order Markov data: test should select order 1
set.seed(1)
states <- letters[1:4]
tm <- matrix(runif(16), 4, 4, dimnames = list(states, states))
tm <- tm / rowSums(tm)
seqs <- lapply(1:30, function(.) {
  s <- character(50); s[1] <- sample(states, 1)
  for (i in 2:50) s[i] <- sample(states, 1, prob = tm[s[i - 1], ])
  s
})
res <- markov_order_test(seqs, max_order = 3, n_perm = 300, seed = 1)
res$optimal_order
summary(res)
plot(res)
}
}
