Skip to content

ENH: Add Gwet's AC1 - #8958

Open
swflint wants to merge 2 commits into
statsmodels:mainfrom
swflint:gwets-ac-1
Open

swflint wants to merge 2 commits into
statsmodels:mainfrom
swflint:gwets-ac-1

Conversation

@swflint

@swflint swflint commented Jul 19, 2023

Copy link
Copy Markdown

This implements Gwet's AC_1 (for two and three or more raters) and adds the relevant tests.

@swflint
swflint force-pushed the gwets-ac-1 branch 3 times, most recently from 4f57531 to f4cedd6 Compare July 19, 2023 23:38
@josef-pkt josef-pkt added this to the 0.15 milestone Jul 20, 2023
@josef-pkt

Copy link
Copy Markdown
Member

Thanks for the PR. Sounds interesting but I never heard of it (which is not surprising given my weak background in this area) and I will need to briefly read up on it, e.g. https://www.sciencedirect.com/science/article/pii/S2215016123002108

I'm currently on vacation and will look at it early August.
prio-elevated as a reminder to myself, or ping me if I forget about the issue

@swflint

swflint commented Aug 29, 2023

Copy link
Copy Markdown
Author

@josef-pkt Is there anything I can do to make this a bit easier to review?

@josef-pkt

Copy link
Copy Markdown
Member

Looks good to me, and I will merge it (doing a rebase)
However, I want to merge #9241 before this PR to minimize merge conflicts.

The new Gwet AC functions return a single number, which is ok. In other cases we use return_results option to return also inferential statistics when available.

One problem is the default for return_results:

Current cohens_kappa has return_results=True
fleiss kappa is currently getting return_results=False
gwet_ac would also need return_results=False for backwards compatibility if or when we add standard error and or other inferential statistics to it.

Trying to read up on Gwet AC, I got confused again about whether an article uses the 2-raiter or many multi-rater method.
The two functions in this PR separate it nicely and minimize confusion.

Aside:
I guess in the long term we can have two functions, one for two raters and one for multiple, raters, that has the option for different versions of the agreement measures.
This would provide single entry for users instead of looking for the right function.

@swflint

swflint commented Oct 23, 2025

Copy link
Copy Markdown
Author

I am happy to rebase & add support for return_results.

@josef-pkt

Copy link
Copy Markdown
Member

Is it possible to add here standard error and confidence interval for ac1?
Then we could add return_result right away.

Gwet's package has it
https://search.r-project.org/CRAN/refmans/irrCAC/html/gwet.ac1.raw.html
formulas are in the original article, but I didn't try to understand those nor see how difficult is to code them.

@josef-pkt

Copy link
Copy Markdown
Member

BTW: I looked at some articles that recommend AC1, and popularity has increasing in recent years (overtaking kappa in one study I saw)

So, this is a very useful addition.

@swflint

swflint commented Oct 24, 2025

Copy link
Copy Markdown
Author

Is it possible to add here standard error and confidence interval for ac1? Then we could add return_result right away.

I can try -- I have his book, so it should be doable in the next few weeks.

Gwet's package has it https://search.r-project.org/CRAN/refmans/irrCAC/html/gwet.ac1.raw.html formulas are in the original article, but I didn't try to understand those nor see how difficult is to code them.

I don't think it should be that difficult. I may bug some folks I work with to add some more IRR values, too.

@josef-pkt

Copy link
Copy Markdown
Member

(wasting) a few more hours trying to figure out a bit what is going on in this literature.

"Gwet's AC1 is not a substitute for Cohen's kappa – A comparison of basic properties"
is kind of funny.
The what I read it is whenever they argue in favor of kappa and against ac1, the argument actually goes the other way.
Those are not "bugs", those are desirable features
:)

I was playing with a numerical example for kappa (no ac1 yet), where the prevalence is also affected by the population prevalence.
To vary prevalence, the story is that there are a high risk and a low risk subpopulations, and the test increases how many low risk subjects are included in the testing/rating.

Related:
hypothesis test for homogeneity across stratified samples.

Honda, Chikara, and Tetsuji Ohyama. 2020. “Homogeneity Score Test of AC1 Statistics and Estimation of Common AC1 in Multiple or Stratified Inter-Rater Agreement Studies.” BMC Medical Research Methodology 20 (1): 20. https://doi.org/10.1186/s12874-019-0887-5.

Aside:
I found many articles for agreement measures when rating categories are ordinal instead of nominal, but I did not look at them.
cohens_kappa has weights but not fleiss kappa.
I remember struggling for some time to get weights into kappa, but I have not looked at it since then (2012).

@swflint

swflint commented Oct 24, 2025

Copy link
Copy Markdown
Author

If I ever have time (ha!), I may try to get some of the other IRR metrics written up, but I'm not a statistician, and don't do a ton of mathematical programming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants