svgtest-information
Test information
Over which range of the trait does the test measure precisely?
How to read it
- Read the solid curve as how precisely the test measures at each ability.
- Read the dashed curve as the standard error on the right axis.
- Precise where the solid curve is high and the dashed is low.
- Callout 1: Most precise at this ability.
- Callout 2: The standard error is large at the extremes.
Watch out
- A single reliability number hides this: precision varies across people.
Defaults
No settings: the chart draws one way.
Pinned in the code
- Draws the run's numbers as given (computed by the Python/R engine); the chart computes nothing statistical.
- Information is the sum of item informations; SE(θ) = 1/√I(θ) when the engine sends it.
# Test information — Codesplash Chart Lab (recipe "test-information")
# controls: defaults
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"]
df = pd.read_csv("test-information-demo.csv", keep_default_na=False, na_values=[""]) # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
TH = "ability θ"
INFO = "test information"
SE = "standard error"
d = df.dropna(subset=[TH, INFO]).sort_values(TH)
fig, ax = plt.subplots(figsize=(8, 4.5))
ax.plot(d[TH], d[INFO], color=PALETTE[0], linewidth=2, label="test information")
ax.set_xlabel(TH)
ax.set_ylabel(INFO)
if SE:
ax2 = ax.twinx()
ax2.plot(d[TH], d[SE], color=PALETTE[1], linestyle="--", linewidth=1.6)
ax2.set_ylabel(SE)
plt.show()Needs pandas, numpy, matplotlib · reads test-information-demo.csv · app theme from the optional codesplash helper
# Test information — Codesplash Chart Lab (recipe "test-information")
# controls: defaults
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
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 px.colors.qualitative.Plotly
df = pd.read_csv("test-information-demo.csv", keep_default_na=False, na_values=[""]) # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
TH = "ability θ"
INFO = "test information"
SE = "standard error"
d = df.dropna(subset=[TH, INFO]).sort_values(TH)
fig = go.Figure()
fig.add_scatter(x=d[TH], y=d[INFO], mode="lines", name=INFO, line=dict(color=PALETTE[0], width=2.5))
if SE:
fig.add_scatter(x=d[TH], y=d[SE], mode="lines", name=SE, yaxis="y2", line=dict(color=PALETTE[1], dash="dash"))
fig.update_layout(yaxis2=dict(overlaying="y", side="right", title=SE))
fig.update_layout(xaxis_title=TH, yaxis_title=INFO)
fig.show()Needs pandas, numpy, plotly · reads test-information-demo.csv · app theme from the optional codesplash helper
# Test information — Codesplash Chart Lab (recipe "test-information")
# controls: defaults
library(ggplot2)
has_cs <- isTRUE(requireNamespace("codesplashr", quietly = TRUE)) # optional: the app's chart theme
theme_cs <- if (has_cs) codesplashr::theme_codesplash(dark = FALSE) else theme_minimal()
cs_cat <- if (has_cs) codesplashr::cs_palette(dark = FALSE)$categorical else grDevices::palette.colors(8, "Okabe-Ito")
if (has_cs) update_geom_defaults("text", list(colour = codesplashr::cs_palette(dark = FALSE)$foreground))
df <- read.csv("test-information-demo.csv", check.names = FALSE, stringsAsFactors = FALSE, na.strings = "") # empty cells are missing; Chart Lab → Code → Download demo CSV
th_col <- "ability θ"
info_col <- "test information"
se_col <- "standard error"
d <- data.frame(th = df[[th_col]], info = df[[info_col]], se = if (is.null(se_col)) NA_real_ else df[[se_col]])
k <- max(d$info, na.rm = TRUE) / max(c(d$se, 1e-9), na.rm = TRUE) # second axis scale
p <- ggplot(d, aes(th)) + geom_line(aes(y = info), colour = cs_cat[1], linewidth = 1) +
{ if (!all(is.na(d$se))) geom_line(aes(y = se * k), colour = cs_cat[2], linetype = "dashed") } +
scale_y_continuous(sec.axis = sec_axis(~ . / k, name = if (is.null(se_col)) "" else se_col)) +
labs(x = th_col, y = info_col) + theme_cs
print(p)Needs ggplot2 · reads test-information-demo.csv · app theme from the optional codesplashr helper