Modulemarkov-chain-usage-model-0.0.0Haskell2010
MarkovChain
- 2 types
- 16 values
- Packagemarkov-chain-usage-model-0.0.0
- Exports18
- LanguageHaskell2010
- LicenceBSD-2-Clause
- SourceMarkovChain.hs
The fundamental matrix for absorbing chains. Its (i, j)-th entry is the expected number of occurrences of state j prior to absorption at the sink, given that one starts in state i. So the first row indicates the expected occurence of each state starting from the start state.
fundamental (minorMatrix 5 5 p :: M)┌ ┐│ 1.0 1.2307692307692306 1.2307692307692308 0.9230769230769231 ││ 0.0 1.2307692307692306 1.2307692307692308 0.9230769230769231 ││ 0.0 0.15384615384615385 2.1538461538461537 0.6153846153846154 ││ 0.0 0.3076923076923077 0.3076923076923077 1.2307692307692308 │└ ┘
Expected variance of the occurrence for each state. The (i, j)-th entry should be read in the same away as that of the fundamental matrix above.
occVariance (fundamental (minorMatrix 5 5 p :: M))┌ ┐│ 0.0 0.28402366863905315 2.5562130177514795 0.4970414201183433 ││ 0.0 0.28402366863905315 2.5562130177514795 0.4970414201183433 ││ 0.0 0.20118343195266267 2.4852071005917153 0.5207100591715977 ││ 0.0 0.3550295857988165 0.9230769230769231 0.2840236686390534 │└ ┘
The Perron eigenvector (long-run occupancies/probabilities of states).
perron p[0.1857142857142857,0.22857142857142854,0.22857142857142856,0.17142857142857143,0.1857142857142857]
Compute the stimulus long-run occupancy.
:{let s :: M s = fromList 4 5 [ 1, 0, 0, 0, 0 , 0, 0.5, 0.5, 0, 0 , 0, 0.5, 0.25, 0.25, 0 , 0.25, 0, 0, 0.5, 0.25 ]in sigma s (perron p):}[0.2807017543859649,0.2807017543859649,0.21052631578947367,0.17543859649122806,5.2631578947368425e-2]
Compute the probability of occurrence for each state.
getRow 1 (nodeProbabilities p)[1.0,1.0,0.5714285714285715,0.75]
Expected test case length.
expectedLength (fundamental (minorMatrix 5 5 p :: M))4.384615384615385
Success rate matrix.
expectedArcReliability Nothing (fromList 2 2 [10,10,10,10], fromList 2 2 [0,1,2,3])(┌ ┐│ 0.9166666666666666 0.8461538461538461 ││ 0.7857142857142857 0.7333333333333333 │└ ┘,┌ ┐│ 5.876068376068376e-3 9.298393913778529e-3 ││ 1.1224489795918367e-2 1.2222222222222223e-2 │└ ┘):{ expectedArcReliability (Just (fromList 2 2 [10,10,10,10], fromList 2 2 [1,1,1,1])) (fromList 2 2 [10,10,10,10], fromList 2 2 [0,1,2,3]):}(┌ ┐│ 0.9130434782608695 0.875 ││ 0.84 0.8076923076923077 │└ ┘,┌ ┐│ 3.3081285444234404e-3 4.375e-3 ││ 5.169230769230769e-3 5.752794214332676e-3 │└ ┘)
kullbackLeibler Kullback-Leibler matrix discrimination.
:{let s = fromList 4 5 [ 1, 0, 0, 0, 0 , 0, 0.5, 0.5, 0, 0 , 0, 0.5, 0.25, 0.25, 0 , 0.25, 0, 0, 0.5, 0.25 ] es = Vector.fromList [4, 5, 7, 3, 4] et = fromList 4 5 [ 4, 0, 0, 0, 0 , 0, 3, 2, 0, 0 , 0, 4, 1, 2, 0 , 1, 0, 0, 1, 1 ]in kullbackLeibler p s es et:}3.440540391434413e-2