Use the interactive controls below to explore how self-reported health varies across different demographic and lifestyle groups in the 2024 CDC BRFSS dataset. Filter by biological sex, leisure-time physical activity, and age bracket to see how the distribution and sample sizes adjust in real time.
Plot.plot({title:"Percent Reporting Excellent or Very Good Health",subtitle:`Showing ${filtered.length} subgroup${filtered.length===1?'':'s'} based on active filters`,width:Math.min(width,820),height:420,marginLeft:55,marginBottom:45,x: { label:"Age Group",domain: ["18–24","25–34","35–44","45–54","55–64","65+"],padding:0.2 },y: { label:"Excellent or Very Good Health (%)",domain: [0,75],grid:true },color: {domain: ["Any Exercise","No Exercise"],range: ["#2b8cbe","#e34a33"],legend:true },marks: [ Plot.barY(filtered, {x:"age_group",y:"pct_display",fill:"exercise",fx: selected_sex ==="All"?"sex":undefined,dodge:"exercise",tip:true,title: d =>`Age: ${d.age_group}\nSex: ${d.sex}\nPhysical Activity: ${d.exercise}\nGood/Excellent Health: ${d.pct_display}%\nSample Size: ${d.total.toLocaleString()} respondents` }), Plot.ruleY([0]) ]})
Subgroup Details
The table below updates automatically to match your selections, displaying exact percentages and sample sizes.
Inputs.table(filtered, {columns: ["age_group","sex","exercise","pct_display","total"],header: {age_group:"Age Group",sex:"Sex",exercise:"Physical Activity",pct_display:"Good/Excellent Health (%)",total:"Sample Size (N)" },format: {pct_display: d =>`${d}%`,total: d => d.toLocaleString() }})