pyfan.stats.markov.transprobcheck.markov_trans_prob_check

pyfan.stats.markov.transprobcheck.markov_trans_prob_check(mt_trans, fl_atol_per_row=1e-05, fl_atol_avg_row=1e-08, fl_sum_to_match=1)[source]

Markov conditional transition probability check

Parameters
mt_transnumpy.array of shape (N, N)

The AR1 transition matrix, each row is a state, each value in each row is the conditional probability of moving from state i (row) to state j (column)

fl_atol_per_rowfloat, optional

Tolerance for the difference between 1 and each row sum

fl_atol_avg_rowfloat, optional

Tolerance for the difference between 1 and average of row sums

fl_sum_to_matchfloat, optional

This should be 1, unless the function is not used to handle transition matrixes

Returns
——-
tuple

A tuple of booleans, the first element is if satisfies the overall criteria. Second is if satisifes the per_row condition. Third if satisfies the average criteria.

Examples

>>> mt_ar1_trans = np.array([[0.4334, 0.5183, 0.0454],
>>>                          [0.2624, 0.5967, 0.1245],
>>>                          [0.1673, 0.5918, 0.2005]])
>>> bl_ar1_sum_pass, bl_per_row_pass, bl_avg_row_pass = markov_trans_prob_check(mt_ar1_trans)
>>> print(f'{bl_ar1_sum_pass=}')
bl_ar1_sum_pass=False
>>> print(f'{bl_per_row_pass=}')
bl_per_row_pass=False
>>> print(f'{bl_avg_row_pass=}')
bl_avg_row_pass=False