Skip to content
svgitem-curves

Item characteristic curves

How does the probability of each response change with the latent trait, item by item?

Demo data · seed 20261101 · 405 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. Read each curve as the probability of a correct response at each ability.
  2. Curves further right are harder items.
  3. Steeper curves separate people better.
  1. Callout 1: An easier item.
  2. Callout 2: A harder item.
  3. Callout 3: A steep curve: a discriminating item.

Watch out

  • Item parameters assume the model fits: check item fit before you trust the curves.

Defaults

Curves
Characteristic (probability)
Show one curve per item or one per response category.
Also: Information

Pinned in the code

  • Draws the run's numbers as given (computed by the Python/R engine); the chart computes nothing statistical.
  • Without a category role every item is a curve in one panel; with one, each item is a panel and each category a curve (graded or partial-credit models).
# Item characteristic curves — Codesplash Chart Lab (recipe "item-curves")
# controls: kind=icc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]
# non-colour encodings per series (same table as the app: series are never told apart by colour alone)
SERIES_DASHES = ["-", (0, (6, 3)), (0, (1.5, 2.5)), (0, (8, 3, 2, 3)), (0, (12, 4)), (0, (3, 3)), (0, (8, 2, 2, 2, 2, 2)), (0, (1.5, 5))]

df = pd.read_csv("item-curves-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["item"] = pd.Categorical(df["item"].astype("string"), categories=["Q1 (easy)", "Q2", "Q3", "Q4", "Q5 (hard)"])

def levels_of(s):
    """Declared level order (categoricals), else order of first appearance."""
    if isinstance(s.dtype, pd.CategoricalDtype):
        return [v for v in s.cat.categories if (s == v).any()]
    return list(dict.fromkeys(s.dropna().astype(str)))
TH = "ability θ"
P = "P(correct)"
ITEM = "item"
CAT = None
items = levels_of(df[ITEM])
panels = items if CAT else [None]
fig, axes = plt.subplots(1, len(panels), figsize=(min(16, 3.4 * len(panels) + 1), 3.8), sharey=True, squeeze=False)
for ax, item in zip(axes[0], panels):
    d = df if item is None else df[df[ITEM].astype(str) == str(item)]
    key = CAT if CAT else ITEM
    for i, lv in enumerate(levels_of(d[key])):
        s = d[d[key].astype(str) == str(lv)].sort_values(TH)
        ax.plot(s[TH], s[P], color=PALETTE[i % len(PALETTE)], linestyle=SERIES_DASHES[i % 8], linewidth=1.8, label=str(lv))  # dash per curve, as in the app
    ax.set_title(str(item) if item is not None else "", fontsize=10, loc="left")
    ax.set_xlabel(TH)
axes[0, 0].set_ylabel("P(response)")
axes[0, 0].legend(fontsize=8)
plt.show()

Needs pandas, numpy, matplotlib · reads item-curves-demo.csv · app theme from the optional codesplash helper