In a model I have a discrete two-state first order Markov process, defined by a (2x2) transition matrix with two free parameters. If the first state occurs then the process outputs zero for that period. If the second state occurs then the process outputs a Gamma-distributed random variable characterised by another two parameters.
I can work out the theoretical mean and variance of the overall stationary process using pen and paper, but I am unsure how to check my results (and also I want to practice my Mathematica) using symbolic calculations. Put another way, I would like to know how to calculate the mean and variance to which the composite Markov-Gamma process will converge. My code is below - all I have currently is a way to calculate the mean of the Markov process, P, and its stationary mean (Mean[S]). However, I would like to be able to derive the mean and variance of R inserted into P for times when the process is in state 2, and zeros for when P is in state 1. Many thanks! Ben
M = {{1 - pdw, pdw}, {pwd, 1 - pwd}}
P = DiscreteMarkovProcess[{1, 0}, M]
S = StationaryDistribution[P]
R = GammaDistribution[a,b]
PDF[P[n], k] // PiecewiseExpand
orMean[P[n]] // FullSimplify
? $\endgroup$