pyValEIA.stats.skill_score

Functions to calculate skill score statistics.

Functions

state_check(truth_vals, test_vals[, event_val])

Calculate the skill state of an observation against truth.

coin_toss_state(event_states)

Calcualte the event states needed for a coin toss outcome.

liemohn_skill_score(event_states[, coin])

Calcualte the Liemohn skill scores using the skill event states.

calc_pc_and_csi(event_states[, coin])

Calculate the percent correct and critical success index.

Module Contents

pyValEIA.stats.skill_score.state_check(truth_vals, test_vals, event_val='eia')[source]

Calculate the skill state of an observation against truth.

Parameters:
truth_valsarray-like

Array of values to compare to event_val specifying the truth status to test against

test_valsarray-like

Array of values to compare to event_val specifying the data status to test against the truth

event_valstr, int, or float

Value specifying the state indicating a positive event (default=’eia’)

Returns:
event_statesarray-like

Categories of skill score states corresponding to the combination of test and truth values for the desired event value

Raises:
ValueError

If test_vals and truth_vals are different lengths

Notes

The skill score states are: - H: hit - M: miss - C: correct negative - F: false alarm

pyValEIA.stats.skill_score.coin_toss_state(event_states)[source]

Calcualte the event states needed for a coin toss outcome.

Parameters:
event_statesarray-like

Array of event states ‘H’, ‘M’, ‘F’, and ‘C’ that will be used to create a coin-toss model of the same size and proportion of truth states

Returns:
hitint

Number of hits for the coin toss model

missint

Number of misses for the coin toss model

falarmint

Number of false alarms for the coin toss model

cornegint

Number of correct negatives for the coin toss model

pyValEIA.stats.skill_score.liemohn_skill_score(event_states, coin=False)[source]

Calcualte the Liemohn skill scores using the skill event states.

Parameters:
event_statesarray-like

array of event states ‘H’, ‘M’, ‘F’, and ‘C’

coinbool

if True, returns will be LSS for a coin if False, returns will be LSS of event_states (default)

Returns
——-
LSS1double

Liemohn Skill Score 1

LSS2double

Liemohn Skill Score 2

LSS3double

Liemohn Skill Score 3

LSS4double

Liemohn Skill Score 4

See also

state_check

References

Liemohn 2025 under review

pyValEIA.stats.skill_score.calc_pc_and_csi(event_states, coin=False)[source]

Calculate the percent correct and critical success index.

Parameters:
event_statesarray-like

array of event states ‘H’, ‘M’, ‘F’, and ‘C’

coinbool

if True, returns will be LSS for a coin if False, returns will be LSS of event_states

Returns:
pcordouble

percent correct as a decimal between 0 and 1

cs_inddouble

critical success index as a decimal between 0 and 1