/** * Chart 2: Arrest rate per 1,000 students by student group (most recent year). * Bar chart — observed rate vs. modeled median rate. */ const GROUP_COLORS = { 'White Female': '#4A74B0', // navy-400 'White Male': '#2E5590', // navy-500 'Black Female': '#AB00AA', // plum-like (from social media posts) 'Black Male': '#8B007F', // darker purple 'Hispanic Female': '#1FAA4A', // green-ish (from wp_group_palette) 'Hispanic Male': '#15903C', 'AI/AN Female': '#D6271E', // red for American Indian emphasis 'AI/AN Male': '#A6271D' } export default function RateByGroupBar({ data }) { const width = 280 const height = 240 const margin = { top: 35, right: 20, bottom: 80, left: 45 } const innerWidth = width - margin.left - margin.right const barHeight = Math.min(16, (innerWidth * 0.7) / data.length) // Y-axis scale — per 1k rate const maxRate = Math.max(...data.map(d => d.observedRate), ...data.map(d => d.modeledMedian || 0), 0.5) return (
{/* Chart title */}

Arrest rate by student group — 2021–22 (per 1,000)

{/* Background */} {/* Y-axis gridlines */} {[0, 0.25, 0.5, 0.75, 1].map((frac) => { const val = frac * maxRate if (val > maxRate) return null const y = margin.top + ((height - margin.top - margin.bottom) - (val / maxRate) * (height - margin.top - margin.bottom)) return ( {val.toFixed(1)} ) })} {/* Y-axis label */} Rate per 1,000 students {/* Bars */} {data.map((d, i) => { const y = margin.top + i * barHeight + 4 const observedWidth = (d.observedRate / maxRate) * innerWidth const modeledWidth = ((d.modeledMedian || d.observedRate) / maxRate) * innerWidth return ( {/* Observed bar */} {d.observedArrests > 0 && ( <> {/* Observed count label */} {d.observedRate > maxRate * 0.1 && ( {d.observedArrests} )} )} {/* Modeled median (dashed outline) */} {d.modeledMedian > 0 && d.modeledMedian !== d.observedRate * (d.stu_enroll || 1) / 1000 && ( )} {/* Group label */} {d.label} ) })} {/* X-axis label */} Solid = observed · Dashed = modeled median {/* Legend */} Observed arrests Modeled median {/* Note */}

Bars show observed arrests per 1,000 students. Dashed outlines show the Bayesian model's median estimate (unified_m2_mod).

) }