NAME

Statistics::Kappa::Weighted - Calculate inter-annotator agreement.

VERSION

Version 0.03

SYNOPSIS

use Statistics::Kappa::Weighted;

sub weight($x, $y) { abs($x - $y) }

my @data = ([3, 2], [2, 2], [1, 1], [2, 2], [3, 3]);
my $ck = 'Statistics::Kappa::Weighted'->new(data   => \@data,
                                            weight => \&weight);
my $kappa =  $ck->kappa;

METHODS

'Statistics::Kappa::Weighted'->new(data => \@data, weight => \&weight)

The constructor. It takes a named argument data which should contain an array reference. The elements of the array should be anonymous arrays of two elements, representing answers by the two raters we are comparing. Another argument is weight which should be a code reference returning the weight of disagreement (0 if the two values are the same). Two values of weight are predefined: strings 'linear' and 'quadratic'. You can use them if the values are numbers and the weight is abs($x - $y) or ($x - $y) ** 2, respectively. Note that using sub { $_[0] != $_[1] } turns the weighted 𝜅 into unweighted 𝜅.

data

weight

AUTHOR

E. Choroba <choroba@matfyz.cz>

BUGS

Please report any bugs or feature requests to the GitHub repository.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Statistics::Kappa::Weighted

You can also look for information at:

SEE ALSO

Other modules from Statistics::Kappa: Statistics::Kappa::Cohen and Statistics::Kappa::Fleiss. Another inter-rater agreement statistics: Statistics::Krippendorff.

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by E. Choroba <choroba@matfyz.cz>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)