Skip to content

Commit

Permalink
Add a test for the ratio measure
Browse files Browse the repository at this point in the history
  • Loading branch information
bryant1410 committed Apr 26, 2019
1 parent 7cdf4fc commit c974cad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion krippendorff/krippendorff.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,16 @@ def alpha(reliability_data=None, value_counts=None, value_domain=None, level_of_
... [0, 0, 1, 1]])
>>> print(round(alpha(value_counts=value_counts, level_of_measurement='nominal'), 6))
0.691358
>>> # The following example comes from
>>> # The following examples were extracted from
>>> # https://www.statisticshowto.datasciencecentral.com/wp-content/uploads/2016/07/fulltext.pdf, page 8.
>>> reliability_data = [[1, 2, 3, 3, 2, 1, 4, 1, 2, np.nan, np.nan, np.nan],
... [1, 2, 3, 3, 2, 2, 4, 1, 2, 5, np.nan, 3.],
... [np.nan, 3, 3, 3, 2, 3, 4, 2, 2, 5, 1, np.nan],
... [1, 2, 3, 3, 2, 4, 4, 1, 2, 5, 1, np.nan]]
>>> print(round(alpha(reliability_data, level_of_measurement='ordinal'), 3))
0.815
>>> print(round(alpha(reliability_data, level_of_measurement='ratio'), 3))
0.797
"""
if (reliability_data is None) == (value_counts is None):
raise ValueError("Either reliability_data or value_counts must be provided, but not both.")
Expand Down

0 comments on commit c974cad

Please sign in to comment.