% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence-networks.R
\name{predict_next_state}
\alias{predict_next_state}
\title{Predict the next state from a transition model}
\usage{
predict_next_state(model, history, top_n = NULL)
}
\arguments{
\item{model}{A higher-order transition model.}

\item{history}{Character vector of observed recent states.}

\item{top_n}{Optional number of states to retain. Returned probabilities
remain on the full-model scale and are not renormalised after truncation.}
}
\value{
A probability table ordered from highest to lowest probability,
with the context order actually used.
}
\description{
Predict the next state from a transition model
}
\examples{
sequences <- data.frame(
  sequence_id = rep(c("s1", "s2", "s3", "s4"), each = 4L),
  sequence_order = rep(1:4, times = 4L),
  state = c("A", "B", "C", "D", "A", "B", "C", "C",
            "D", "C", "B", "A", "D", "C", "A", "A"),
  group = rep(c("g1", "g2"), each = 8L),
  stringsAsFactors = FALSE
)
model <- fit_higher_order_transition_model(sequences, order = 2L)
predict_next_state(model, c("A", "B"))

}
