% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Seq2Prob.R
\name{Seq2Prob}
\alias{Seq2Prob}
\title{Convert Observation Sequences to Co-occurrence Matrix/Tensor}
\usage{
Seq2Prob(Y, N = NULL, order = 2L, lag = 1L, smooth = 0)
}
\arguments{
\item{Y}{Integer vector of observations (values in 1:N), or a list of
integer vectors for multiple sequences.}

\item{N}{Number of distinct observation symbols. If NULL, inferred from data.}

\item{order}{Co-occurrence order: 2 (pairwise, default) or 3 (triple).
Order 2 gives an N x N matrix \eqn{P_{2,1}(i,j) = P(Y_2=i, Y_1=j)}.
Order 3 gives an N x N x N tensor \eqn{P_{3}(i,j,k) = P(Y_3=i, Y_2=j, Y_1=k)}.}

\item{lag}{Lag for pairwise co-occurrence (default: 1).
\eqn{\Omega^{(\tau)}(i,j) = P(Y_t=i, Y_{t+\tau}=j)}.
Only used when \code{order = 2}.}

\item{smooth}{Laplace smoothing pseudo-count (default: 0).
Adds \code{smooth} to all counts before normalization.}
}
\value{
For \code{order = 2}: an N x N matrix (normalized).
  For \code{order = 3}: an rTensor Tensor object of dimension N x N x N.
}
\description{
Constructs empirical co-occurrence statistics from observation sequences.
These form the basis for matrix/tensor decomposition approaches to HMM.
}
\examples{
Y <- c(1, 2, 3, 1, 2, 3, 1, 2, 3)
P2 <- Seq2Prob(Y, N = 3, order = 2)
P3 <- Seq2Prob(Y, N = 3, order = 3)
}
