## Processes Class MarkovChain

```java.lang.Object
Processes.StochasticProcess
Processes.MarkovChain
```
Direct Known Subclasses:
SFSMarkovChain, StoppableMarkovChain

public abstract class MarkovChain
extends StochasticProcess

A Markov chain with states 0,1,2... and time * dependent transition probabilities delivered by * the abstract method q(t,i,j). * *

This will be viewed as a stochastic sequence (dt=1) with * integer valued paths (stored in double[] path). The value * of the path at time t is the state the chain is in at * that time.

* *

The state transition is handled as follows: * Suppose that current time is t and we are in state i. The probability that * the chain moves to state j is given by q(t,i,j).

* *

The interval [0,1) is partitioned into subintervals * I_0,I_1,... of lengths q(t,i,0), q(t,i,1),... * respectively. We then draw a uniform random number u from [0,1). * If u falls into the interval I_j the chain moves to state j.

* *

Vastly more efficient sampling is introduced for finite state * stationary Markov chains: `SFSMarkovChain`.

* * @author Michael J. Meyer

 Constructor Summary ```MarkovChain(int T, double j_0)```           Constructor allocates the stochastic process `super.this` * with dt=1.

 Method Summary `abstract  double` ```q(int t, int i, int j)```           q(t,i,j) is the probability at time t that * the chain moves from state i to state j. ` void` `timeStep(int t)`           Evolves the path of the chain from time t to time t+1.

 Methods inherited from class Processes.StochasticProcess `get_dt, get_path, get_T, get_X_0, newPath, newPathBranch, pathSegment, pathSegment, pathSegment, sampledAt, simulationInit, timeStep`

 Methods inherited from class java.lang.Object `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

 Constructor Detail

### MarkovChain

```public MarkovChain(int T,
double j_0)```

Constructor allocates the stochastic process `super.this` * with dt=1.

* * @param T time steps to horizon * @param j_0 initial state

 Method Detail

### q

```public abstract double q(int t,
int i,
int j)```

q(t,i,j) is the probability at time t that * the chain moves from state i to state j.

* * @param t current time * @param i current state * @param j next state

### timeStep

`public void timeStep(int t)`

Evolves the path of the chain from time t to time t+1. * See transition.

Specified by:
`timeStep` in class `StochasticProcess`