The Pilot: Kappa and Alpha

S20 · Chapter 10

Today’s Agenda

  • What a pilot test is, and why the two coding passes must be independent
  • Why raw agreement makes a codebook look better than it is
  • Kappa and alpha: two reliability statistics, and how to read the number
  • How to diagnose a failed pilot and run it again

Testing the Codebook With a Pilot

Lab session

  • Tuesday you drew a sample; today the codebook is tested against real items
  • We run a pilot and turn agreement between two coding passes into one number
    • We watch an example codebook fail, and diagnose why
    • You leave with a reliability coefficient for your own instrument
  • A reliability coefficient is a single score, usually between 0 and 1, for how consistent your coding was

A pilot can send you back to Chapter 8 to rewrite rules, and that is a normal result.

What a Pilot Test Is

Pilot test: a practice round, before any real coding, where you code a few items twice to see if your codebook’s rules give the same answer both times. Example: code twenty sampled messages on Monday, then again on Wednesday with Monday’s codes hidden.

  • Take a subset of your sample: ten to twenty items
  • Code them from the same codebook, twice, then compare the two sets of codes
  • The question the pilot answers: do the same written rules produce the same classifications?

Coding Twice by Yourself

  • In this course you are the only coder, so you code the items twice yourself
    • At least 48 hours apart, with your first codes hidden
    • Re-code at least a quarter of the pilot items on the second pass
  • Each round of coding is called a pass: pass 1 and pass 2

Variables, Revisited

Recap from Session 19

Variable: something about a case that can change from one case to the next, where a case is one thing you study, such as one chat message.

  • Message target is a variable: its value changes from one message to the next
  • In the pilot you record that value for each item, once per pass

Where the Codes Go

Coding sheet: the grid where you record each item’s code for every variable in the codebook. Example: a spreadsheet with one row per sampled message and one column per variable, such as message target.

  • The codebook says how to decide each code; the coding sheet is where you write it down
  • An id column matches every code back to its item
  • For the pilot, each pass on a variable gets its own column, pass_1 and pass_2, which the reliability check compares

Start from the coding sheet template (CSV).

What Reliability Means

Reliability: your codebook gives the same code to the same item every time, whoever applies it and whenever. Example: on both passes, a message that tags the streamer is coded “directed at the streamer.”

  • The pilot is how reliability stops being a hope and becomes a number
  • A codebook that is not reliable gives different answers to the same message

The Two Passes Must Be Independent

Independent: each coding pass is done without seeing, discussing, or remembering the other. Example: your Monday codes stay in a hidden file until Wednesday’s pass is finished.

  • This is not suspicion of the coder: the pilot measures the codebook, not the coder
  • If you reread your first codes before the second pass, you measure your memory, not the rules
  • For one coder, independence means a time gap and a blind: 48 hours, first codes hidden

The Obvious Number Is Raw Agreement

Raw agreement: the share of items where your two passes gave the same code. Example: 74 of 100 items match, so raw agreement is 74 percent.

  • Seventy-four percent agreement sounds respectable
  • That number is misleading, and seeing why is the key idea of the chapter
  • Some agreement happens by coincidence, for no good reason at all

Exercise: Judge the Example Pilot

Use Chapter 10, Why raw agreement is not enough and Cohen’s kappa and Krippendorff’s alpha, to answer:

  • Is 74 percent agreement good enough to start coding for real? Answer yes or no
  • Two coders who flip coins to choose between two categories will agree how often?
  • If both coders use one category almost all the time, would you expect them to agree often just by chance? Why or why not?
  • What agreement number would satisfy you, and where does that number come from?

Why Raw Agreement Misleads

Chance agreement: matches that happen by luck, even when nobody follows a rule. Example: two people flipping coins to sort messages into two categories agree about half the time.

  • The founding paper on kappa imagined two clinicians sorting patients blindly (Cohen, 1960)
    • Each assigns categories blindly, at the rates those categories occur
    • Without coordinating at all, they still agree often
  • That agreement comes from the number of categories and how often each is used
    • It reflects no judgment at all
  • Raw agreement counts coincidence and genuine agreement alike

Cohen’s Kappa

Cohen’s kappa: a score for how much two coding passes agree beyond what luck alone would give. Example: the example pilot scores 0.236, so most of its agreement was luck.

kappa = (observed - expected) / (1 - expected)
  • Observed: the raw agreement your two passes produced
  • Expected: the chance agreement, what luck alone would produce
  • Kappa credits the codebook only with the difference (Cohen, 1960)

Kappa From Zero to One

  • Agreement no better than chance: the top of the formula is zero, so kappa is zero
  • Perfect agreement: kappa is one
  • Kappa is built for two sets of codes and nominal categories
    • Two coders, or one coder twice

Nominal: categories that are only names, with no order. Example: “directed at the streamer” is not more or less than “broadcast to the room.”

Krippendorff’s Alpha

Krippendorff’s alpha: a reliability score like kappa that also works with more than two passes, ranked or numeric codes, and missing codes. Example: three coders rating how heated a message is from 1 to 5 (Krippendorff, 2018).

  • For a pilot with two passes and nominal categories, kappa and alpha agree
    • Kappa is the more familiar choice, so it is the one we report
  • If a pass skipped an item, alpha can still run

Running the Check

v2v::reliability(
  pull(pilot, pass_1),
  pull(pilot, pass_2),
  method = "kappa"
)

reliability() takes two columns of codes and returns the coefficient, with method = "kappa" or method = "alpha" selecting which one. pull() takes one named column out of a table.

Or type your two passes into the Companion’s Reliability grid. It saves them as a CSV (a plain spreadsheet file) and writes this same call into your script, after the irr calls it stands for. To enter the codes themselves, the Companion’s data viewer (Open the data viewer) adds coding columns beside your sampled CSV, like the spreadsheet, and never changes the original file.

The Result

Reliability: Cohen's kappa

  Items coded          100
  Observed agreement   0.74
  Cohen's kappa        0.236  (fair (Landis & Koch 1977))

  The same number, without v2v: irr::kappa2(data.frame(pass_1, pass_2))
  • Observed agreement was 0.74, the respectable-looking number
  • Chance alone would produce about 0.66, given how often each category was used
  • The formula returns 0.236

Almost all of the raw agreement was coincidence.

Why the Example Failed: Two Rules Under One Name

  • The example codebook said “high-energy” and never defined it
    • Coder A read it as “the message carries a Twitch emote”
    • Coder B read it as “the message is shouted, in all capitals”
  • Both readings are reasonable
    • Both coders believed they were coding one variable, one trait of each message
    • Emotes and all-caps overlap often enough to agree by accident

The example is a published two-coder illustration. One coder working twice fails the same way when a rule is undefined.

Reading the Number

Published ranges attach labels to kappa values (Landis and Koch, 1977):

  • 0.0 to 0.2: slight
  • 0.2 to 0.4: fair
  • 0.4 to 0.6: moderate
  • 0.6 to 0.8: substantial
  • Above 0.8: almost perfect

By these labels 0.236 is “fair.” Published work treats a kappa below 0.70 as too low to proceed on, and 0.80 as a comfortable floor.

Diagnose, Revise, Re-Pilot

  • A kappa of 0.236 is an instruction to fix the codebook, not a final result
  • Go back to the items the two passes coded differently
    • Walk through each one with the written rule in front of you
    • The disagreements are the data: each one points at a rule that is unclear
  • Repair the rule in writing, then pilot again

The second pilot uses fresh items, independent coding passes, and produces another coefficient.

Common Errors Today

  • object 'pilot' not found: the two sets of codes are not in one table
  • Columns of different lengths: one pass skipped an item
  • Kappa of exactly 1: you passed the same column twice
  • Kappa near 0 with high agreement: the signature of a loosely defined rule
  • NA in the result: some codes are missing, so use alpha instead

Copy the error and run AURA: Explain an R error from the Command Palette.

Checkpoint

You should now have:

  • A pilot of ten to twenty items from your sample, with at least a quarter coded twice
  • A v2v::reliability() call that runs and returns a number
  • A written note on whether your number clears 0.70
  • The list of items your two passes coded differently, which is your revision list
  • If the pilot failed, a revised rule for each disagreement

Before Next Time

Questions, Comments, or Concerns?