I have a Markov chain defined by the output of two other Markov chains as time passes. (i.e., Z = X + Y).
How do I program such a Markov chain in Mathematica?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI have a Markov chain defined by the output of two other Markov chains as time passes. (i.e., Z = X + Y).
How do I program such a Markov chain in Mathematica?
You can combine processes with TransformedProcess
in much the same way that you can combine probability distributions with TransformedDistribution
. Here's an example:
proc1 = DiscreteMarkovProcess[{1, 0}, {{0.5, 0.5}, {0.5, 0.5}}];
proc2 = DiscreteMarkovProcess[{1, 0}, {{0.3, 0.7}, {0.3, 0.7}}];
proc3 = TransformedProcess[
x[t] + y[t],
{x \[Distributed] proc1, y \[Distributed] proc2},
t
];
PDF[proc3[3], n] // InputForm
ListPlot @ RandomFunction[
proc3,
{0, 10}
]
Piecewise[{{0.15, n == 2}, {0.35, n == 4}, {0.5, n == 3}}, 0]