Package dev.nm.stat.markovchain
Class SimpleMC
java.lang.Object
dev.nm.stat.markovchain.SimpleMC
- All Implemented Interfaces:
RandomNumberGenerator
,Seedable
- Direct Known Subclasses:
HMMRNG
This is a time-homogeneous Markov chain with a finite state space. It is a mathematical system
that undergoes transitions from one state to another, between a finite or countable number of
possible states. It is a random process characterized as memoryless: the next state depends only
on the current state and not on the sequence of events that preceded it. This specific kind of
"memorylessness" is called the Markov property.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA()
Gets the state transition probabilities.static int
bin
(MultinomialRVG rvg) Picks the first non-empty bin.static Vector
Gets the stationary state probabilities of a Markov chain that is irreducible, aperiodic and strongly connected (positive recurrent).double
Gets the next simulated state.int
Gets the next simulated state.int
nStates()
Gets the number of states.PI()
Gets the initial state probabilities.void
seed
(long... seeds) Seed the random number/vector/scenario generator to produce repeatable experiments.
-
Constructor Details
-
SimpleMC
Constructs a time-homogeneous Markov chain with a finite state space.- Parameters:
PI
- the initial state probabilitiesA
- the state transition probabilities
-
-
Method Details
-
seed
public void seed(long... seeds) Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments. -
nextDouble
public double nextDouble()Gets the next simulated state.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
- Returns:
- next state
-
nextState
public int nextState()Gets the next simulated state.- Returns:
- next state
-
PI
Gets the initial state probabilities.- Returns:
- the initial state probabilities
-
A
Gets the state transition probabilities.- Returns:
- the state transition probabilities
-
nStates
public int nStates()Gets the number of states.- Returns:
- the number of states
-
getStationaryProbabilities
Gets the stationary state probabilities of a Markov chain that is irreducible, aperiodic and strongly connected (positive recurrent). A stationary distribution vector x (if exists) satisfies \[ x' \times A = x' \] where x' denotes the transpose of x, and the sum of all elements of x is 1.- Parameters:
A
- the transition matrix- Returns:
- the stationary state probabilities
-
bin
Picks the first non-empty bin.- Parameters:
rvg
- aMultinomialRVG
- Returns:
- the first non-empty bin
-