# How do I change the initial state of a discrete Markov process?

I have a simple Markov process defined with

mp = DiscreteMarkovProcess[1, ( {
{1/3, 1/3, 1/3, 0},
{1/2, 1/4, 0, 1/4},
{0, 0, 1, 0},
{0, 0, 0, 1}
} )];


How I change the initial state of this process, without defining an entirely new process. Is there a way to "set" the initial probabilities of mp to different values?

-
Your question is unclear: the initial state is... a state, not a probability. Is that what you want to change, or do you mean you want to change the transition matrix without redefining it? If the latter, just make the matrix symbolic, and then enclose your cases in Block, with the symbols defined to the values you want. – ciao May 10 '14 at 22:17
The first argument can be either a single state or a list of initial state probabilities. You can simply define mp as a function having the initial state or state vector as one of its arguments. – Sjoerd C. de Vries May 10 '14 at 22:46
@SjoerdC.deVries: That sounds like the answer (if in fact there's no particular way to change the initial state once it's been set. – raxacoricofallapatorius May 11 '14 at 2:27
@raxacoricofallapatorius: You can use the same technique I allude to for initial state, just define the state as a symbol, easy peasy. – ciao May 11 '14 at 4:48
@rasher: If you change the answer to match the question (about initial state, not the transition matrix), that will work. – raxacoricofallapatorius May 12 '14 at 16:44

Resetting the first Part of mp, e.g., mp[[1]]=2 seems to work.

mp = DiscreteMarkovProcess[1, ({{1/3, 1/3, 1/3, 0}, {1/2, 1/4, 0, 1/4}, {0, 0, 1, 0},
{0, 0,  0, 1}})];
Row[{MarkovProcessProperties[mp] /. Grid[x_, y__] :>
Grid[x[[Join[Range[4], Range[-8, -1]]]], y],
mp[[1]] = 2; MarkovProcessProperties[mp] /. Grid[x_, y__] :>
Grid[x[[Join[Range[4], Range[-8, -1]]]], y]},  Spacer[5]]


-

There's no feature of DiscreteMarkovProcess that supports this, but you can accomplish what you want using basic language features, for example:

mp = DiscreteMarkovProcess[state, ( {
{1/3, 1/3, 1/3, 0},
{1/2, 1/4, 0, 1/4},
{0, 0, 1, 0},
{0, 0, 0, 1}} )];

Block[{state=3}, <do stuff with MP>...]


Of course, you need to insure that whatever symbol you choose to use is not defined at the time of the DMP definition, otherwise that value will be used in the definition.

-