apaMarkov.PathProbability.Conditional(StatePath, TransProbs)
=apaMarkov.PathProbability.Conditional(StatePath, TransProbs)Result
Calculates the probability of an observed state path, given a transition probability matrix and conditional on the first state.
Syntax
StatePath: n x 1 or 1 x n vector of integer state labels from 1 to k, where k is the number of rows of TransProbs
TransProbs: matrix of transition probabilities, each row summing to one
Algorithm
Inputs are validated: TransProbs is square and every element of StatePath is an integer between 1 and k. A path with a single observation has conditional probability 1.
Treat the first state in StatePath as given. The conditional probability of the path is the product of all one-step transition probabilities along the path:
Return the conditional path probability.
