Learn R Programming

samurais (version 0.1.0)

hmmProcess: hmmProcess calculates the probability distribution of a random process following a Markov chain

Description

hmmProcess calculates the probability distribution of a random process following a Markov chain

Usage

hmmProcess(prior, trans_mat, n)

Arguments

prior

Numeric vector or a one row matrix of length K representing the prior probabilities of the Markov chain.

trans_mat

Matrix of size \((K, K)\) representing the transition matrix of the Markov chain.

n

Numeric. Number of variables of the Markov chain.

Value

Matrix of size \((n, K)\) giving the distribution of process given the K-state Markov chain parameters.

Details

hmmProcess calculates the distribution \(P(Z_{1},\dots,Z_{n};\pi,A)\) of a Markov chain \((Z_{1},\dots,Z_{n})\) with prior probability \(\pi\) and transition matrix \(A\).

The calculation is based on the following formula:

\(P(Z_{i} = k) = \sum_{l} P(Z_{i} = k, Z_{i-1} = l) = \sum_{l} P(Z_{i} = k | Z_{i-1} = l) \times P(Z_{i-1} = l) = \sum_{l} A_{lk} \times P(Z_{i-1})\)