import React, { useRef, useState, useEffect } from "react"; import { ArrowDown, Check, BookOpen, Target, BarChart3, Calculator, } from "lucide-react"; import DataModifierWidget from "../../../components/lessons/DataModifierWidget"; import BoxPlotComparisonWidget from "../../../components/lessons/BoxPlotComparisonWidget"; import ConfidenceIntervalWidget from "../../../components/lessons/ConfidenceIntervalWidget"; import StudyDesignWidget from "../../../components/lessons/StudyDesignWidget"; import Quiz from "../../../components/lessons/Quiz"; import { CENTER_SPREAD_QUIZ_DATA, DISTRIBUTIONS_QUIZ_DATA, INFERENCES_QUIZ_DATA, } from "../../../utils/constants"; interface LessonProps { onFinish?: () => void; } const DataAnalysisLesson: React.FC = ({ onFinish }) => { const [activeSection, setActiveSection] = useState(0); const sectionsRef = useRef<(HTMLElement | null)[]>([]); const scrollToSection = (index: number) => { setActiveSection(index); sectionsRef.current[index]?.scrollIntoView({ behavior: "smooth", block: "start", }); }; useEffect(() => { const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { const index = sectionsRef.current.indexOf( entry.target as HTMLElement, ); if (index !== -1) { setActiveSection(index); } } }); }, { rootMargin: "-20% 0px -60% 0px", }, ); sectionsRef.current.forEach((section) => { if (section) observer.observe(section); }); return () => observer.disconnect(); }, []); const SectionMarker = ({ index, title, icon: Icon, }: { index: number; title: string; icon: any; }) => { const isActive = activeSection === index; const isPast = activeSection > index; return ( ); }; const DATA_ANALYSIS_QUIZ_DATA = [ ...CENTER_SPREAD_QUIZ_DATA, ...DISTRIBUTIONS_QUIZ_DATA, ...INFERENCES_QUIZ_DATA, ]; return (
{/* Section 1: Data Changes */}
{ sectionsRef.current[0] = el; }} className="min-h-screen flex flex-col justify-center mb-24 pt-20 lg:pt-0" >

Effects of Data Changes

The SAT often asks how the Mean, Median, and Standard Deviation change without doing the full math.

  • Add Constant: Center shifts, Spread stays same.
  • Multiply Constant: Center and Spread both scale.
  • Outliers: Pull the Mean strongly, but the Median is resistant.
{/* Section 2: Distributions */}
{ sectionsRef.current[1] = el; }} className="min-h-screen flex flex-col justify-center mb-24" >

Comparing Distributions

Box Plots are the fastest way to compare Median and Spread (IQR & Range). Remember: The box contains the middle 50% of the data.

{/* Section 3: Inferences */}
{ sectionsRef.current[2] = el; }} className="min-h-screen flex flex-col justify-center mb-24" >

Data Inferences & Margin of Error

A Confidence Interval (Estimate ± Margin of Error) gives a range where the true population value likely lies.
To compare two groups, check for overlap.

{/* Section 4: Study Design */}
{ sectionsRef.current[3] = el; }} className="min-h-screen flex flex-col justify-center mb-24" >

Study Design: Conclusion Logic

Two magic phrases determine what you can conclude:
1. Random Sampling allows Generalization.
2. Random Assignment allows Causation.

{/* Section 5: Quiz */}
{ sectionsRef.current[4] = el; }} className="min-h-screen flex flex-col justify-center" >

Practice Time

{DATA_ANALYSIS_QUIZ_DATA.map((quiz) => (
))}

Topic Mastered!

); }; export default DataAnalysisLesson;