SciPy

prob140.MarkovChain.distribution

MarkovChain.distribution(starting_condition, steps=1)[source]

Finds the distribution of states after n steps given a starting condition.

Parameters:
starting_condition : state or Table

The initial distribution or the original state.

n : integer

Number of transition steps.

Returns:
Table

Shows the distribution after n steps

Examples

>>> states = make_array('A', 'B')
>>> transition_matrix = np.array([[0.1, 0.9],
...                               [0.8, 0.2]])
>>> mc = MarkovChain.from_matrix(states, transition_matrix)
>>> mc.distribution(start)
State | Probability
A     | 0.24
B     | 0.76
>>> mc.distribution(start, 0)
State | Probability
A     | 0.8
B     | 0.2
>>> mc.distribution(start, 3)
State | Probability
A     | 0.3576
B     | 0.6424