statsmodels.stats.inter_rater.to_table¶
-
statsmodels.stats.inter_rater.
to_table
(data, bins=None)[source]¶ convert raw data with shape (subject, rater) to (rater1, rater2)
brings data into correct format for cohens_kappa
- Parameters
- dataarray_like, 2-Dim
data containing category assignment with subjects in rows and raters in columns.
- bins
None
,int
ortuple
of
array_like If None, then the data is converted to integer categories, 0,1,2,…,n_cat-1. Because of the relabeling only category levels with non-zero counts are included. If this is an integer, then the category levels in the data are already assumed to be in integers, 0,1,2,…,n_cat-1. In this case, the returned array may contain columns with zero count, if no subject has been categorized with this level. If bins are a tuple of two array_like, then the bins are directly used by
numpy.histogramdd
. This is useful if we want to merge categories.
- Returns
- arr
nd_array
, (n_cat
,n_cat
) Contingency table that contains counts of category level with rater1 in rows and rater2 in columns.
- arr
Notes
no NaN handling, delete rows with missing values
This works also for more than two raters. In that case the dimension of the resulting contingency table is the same as the number of raters instead of 2-dimensional.