Fleiss‘ kappa

Fleiss’ kappa is a statistical measure used to assess the reliability or agreement among multiple raters when categorizing items into multiple categories. It is an extension of Cohen’s kappa, which is used for measuring agreement between two raters.

Fleiss’ kappa takes into account the possibility of agreement occurring by chance and provides a measure of agreement that corrects for chance agreement. It is commonly used in fields such as psychology, sociology, and medical research where multiple raters are involved in the classification of items.

The formula for Fleiss’ kappa involves calculating the observed agreement among raters and comparing it to the expected agreement due to chance. The formula is as follows:

κ = (P_obs - P_exp) / (1 - P_exp)

where κ is the Fleiss’ kappa value, P_obs is the observed proportion of agreement among raters, and P_exp is the expected proportion of agreement due to chance.

Fleiss’ kappa ranges from -1 to 1, where a value of 1 indicates perfect agreement, 0 indicates agreement equivalent to chance, and negative values indicate less agreement than expected by chance.

It’s worth noting that Fleiss’ kappa assumes that the categories being rated are mutually exclusive and that each item being rated falls into only one category. Additionally, it is important to have an adequate number of raters and items to obtain reliable results when using Fleiss’ kappa.

Fleiss’ kappa can be affected by various factors, including the number of raters, the number of categories, and the distribution of ratings.

import numpy as np

def fleiss_kappa(ratings):
    num_subjects, num_categories = ratings.shape
    num_items = np.sum(ratings[0, :])  # Assuming equal number of items rated by each subject

    # Calculate the observed agreement
    p_obs = np.sum(ratings * ratings, axis=1)
    p_obs = (p_obs - num_items) / (num_items * (num_items - 1))

    # Calculate the expected agreement
    p_j = np.sum(ratings, axis=0) / (num_subjects * num_items)
    p_exp = np.sum(p_j * p_j)

    # Calculate Fleiss' kappa
    kappa = (np.mean(p_obs) - p_exp) / (1 - p_exp)

    return kappa
ratings = np.array([
    [0, 3, 1, 0],  # Subject 1's ratings
    [1, 2, 1, 0],  # Subject 2's ratings
    [0, 1, 3, 0],  # Subject 3's ratings
    [0, 0, 0, 4]   # Subject 4's ratings
])

kappa = fleiss_kappa(ratings)
print("Fleiss' kappa:", kappa)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

bit_lin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值