# Hidden Markov Processes with Discrete or Continuous, Univariate or Multivariate Emissions

Define the initial probabilities and the conditional transition probabilities for the hidden states' dynamics.

 In[1]:= Xp0 = {1/2, 1/2}; tm = {{3/4, 1/4}, {2/5, 3/5}};

Define hidden Markov process with categorical emissions.

 In[2]:= Xhmm1 = HiddenMarkovProcess[p0, tm, {{2/3, 1/3}, {0, 1}}];

Define hidden Markov process with general discrete emissions.

 In[3]:= Xhmm2 = HiddenMarkovProcess[p0, tm, {GeometricDistribution[1/3], NegativeBinomialDistribution[5, 1/4]}];

Define hidden Markov process with continuous emissions.

 In[4]:= Xhmm3 = HiddenMarkovProcess[p0, tm, {NormalDistribution[2, 1], StudentTDistribution[-2, 1, 7]}];

Define hidden Markov processes with multivariate emissions.

 In[5]:= Xhmm4 = HiddenMarkovProcess[p0, tm, {MultivariatePoissonDistribution[2, {5, 6}], NegativeMultinomialDistribution[6, {1/3, 1/4}]}];
 In[6]:= Xhmm5 = HiddenMarkovProcess[p0, tm, {BinormalDistribution[{-1, 2}, {1, 1}, 1/2], BinormalDistribution[{2, -1}, {1, 1}, -1/2]}];

Sample each hidden Markov process.

 In[7]:= XprocList = {hmm1, hmm2, hmm3, hmm4, hmm5};
 In[8]:= XpathList = Table[RandomFunction[proc, {0, 100}], {proc, procList}];

Compute loglikelihood of each path for the respective process.

 In[9]:= XMapThread[LogLikelihood, {N[procList], pathList}]
 Out[9]=

Visualize sample paths of processes with univariate emissions.

 Out[10]=

Visualize components of sample paths of processes with multivariate emissions.

 Out[12]=

## Mathematica + Mathematica Online

Questions? Comments? Contact a Wolfram expert »