Home   >   User Resources   >   Online Help   >   apaMarkov.PathProbability.Unconditional
 

 

Function index Version 3.0.0

apaMarkov.PathProbability.Unconditional(StatePath, InitialStateDistribution, TransProbs)

Excel=apaMarkov.PathProbability.Unconditional(StatePath, InitialStateDistribution, TransProbs)

Result

Calculates the unconditional probability of an observed state path.

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

InitialStateDistribution: 1 x k or k x 1 vector of first-state probabilities, non-negative and summing to one

TransProbs: matrix of transition probabilities, each row summing to one

Algorithm

Inputs are validated: TransProbs is square, every element of StatePath is an integer between 1 and k, and InitialStateDistribution has k non-negative elements whose sum differs from one by at most 1e-6.

Take the probability of the first state from the initial state distribution and multiply by the transition probabilities along the path:

P(s1,…,sn)=πs1∏t=2npst−1,st.P(s_{1},\ldots,s_{n}) = \pi_{s_{1}}\prod_{t = 2}^{n}p_{s_{t - 1},s_{t}}. Return the unconditional path probability.