class: center middle main-title section-title-4 # Introduction to the<br>t-test .class-info[ **Topic 8 · Thursday, February 4 and Tuesday, February 9** .light[EDUC 15: Statistics for Education Research<br> UCI School of Education ] ] --- class: title title-8 # Where are we? .pull-left-3[ .box-1.medium[Description] .box-inv-1.small[Summarize data] .box-inv-1.small[Visualize data] ] .pull-middle-3[ .box-6.medium[Prediction] .center[**We are here**] .anteater[] ] .pull-right-3[ .box-3.medium[Explanation] ] .source[Peter the Anteater at a UC Irvine basketball game.] ??? Same map. We can test a hypothesis, but so far only when someone hands us the population's SD. This topic removes that crutch. Two sessions, six blocks. --- class: title title-8 # The four steps stay. Step 3 changes .box-inv-8.small.sp-after-half[Step 1: State a hypothesis about the population: H₀] .box-inv-8.small.sp-after-half[Step 2: Set the criteria: choose α and find the critical region] .box-8.small.sp-after-half[Step 3: Observe a sample and compute a test statistic] .box-inv-8.small[Step 4: Reject or maintain H₀] ??? Same four steps as Topic 7. By the end of Thursday, step 3 works without knowing σ, and step 2 has a new table. --- name: outline class: title title-8 # Plan for today .box-1.medium.sp-after-half[One tail or two?] .box-6.medium.sp-after-half[When we don't know σ] .box-3.medium.sp-after-half[The t-test] .box-inv-8.small[On Tuesday: how big is the effect, and how sure are we?] ??? Three blocks today, three on Tuesday. The first is a short review of something from Topic 7 that comes up again in every test. --- layout: false class: center middle section-title section-title-1 animated fadeIn # One tail or two? --- layout: true class: title title-1 --- # A directional hypothesis picks a side <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:left;"> Non-directional H₀ </th> <th style="text-align:left;"> Directional H₀ </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> In symbols </td> <td style="text-align:left;"> μ = 100 </td> <td style="text-align:left;"> μ ≤ 100 </td> </tr> <tr> <td style="text-align:left;"> Laptops in class </td> <td style="text-align:left;"> Laptops don't affect learning </td> <td style="text-align:left;"> Laptops don't improve learning </td> </tr> <tr> <td style="text-align:left;"> Cat videos </td> <td style="text-align:left;"> Cat videos don't change your happiness </td> <td style="text-align:left;"> Cat videos don't make you happier </td> </tr> </tbody> </table> .box-1.small[A directional test says which way the mean should move, not only that it moves] ??? Ask students to state the H₁ for each one. For μ = 100, H₁ is μ ≠ 100. For μ ≤ 100, H₁ is μ > 100. For the laptops, H₁ is that laptops affect learning, or that they improve it. --- # Same α, one tail: the cutoff moves in <img src="08-t-test_files/figure-html/one-tail-plot-1.png" alt="Two normal curves of z-scores. In the left curve, for a two-tailed test, 2.5 percent is shaded in each tail, beyond minus 1.96 and 1.96. In the right curve, for a one-tailed test, all 5 percent is shaded in the right tail, beyond 1.65." width="92%" style="display: block; margin: auto;" /> .box-inv-1.small[With α = 0.05 in one tail, the critical z is 1.65, not 1.96. Type I errors stay at 5%] ??? The total of 5% hasn't changed. It's only moved. The exact one-tailed value is 1.645, and the book's table rounds it to 1.65. --- layout: false class: title title-8 # Predict it: One tail, and a real effect .box-inv-8.small.sp-after-half[H₀ says μ = 100, with σ = 15 and n = 10. In truth, μ = 113.4, so d = 0.89. A two-tailed test has 80% power] .box-8.small[We switch to a one-tailed test on the right, and keep α = 0.05. What happens to power?] .options[ .option[ **A** It goes up ] .option[ **B** It goes down ] .option[ **C** It stays the same ] .option[ **D** We can't say without the data ] ] ??? About 6 minutes for this slide and the next two. Hands are fine. Neighbor first, then vote. Power is the share of samples that correctly reject H₀. --- class: title title-8 press-slide # Predict it: Switch to one tail <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=power&n=10&d=0.89&tails=two" title="Simulator's power view for a two-tailed test with d of 0.89 and n of 10. Two normal curves, H0 and H1, with critical values on both sides. Power reads 80 percent." loading="lazy"></iframe> <img class="sim-static" src="img/sim/c40b7faa8bb6.png" alt="Simulator's power view for a two-tailed test with d of 0.89 and n of 10. Two normal curves, H0 and H1, with critical values on both sides. Power reads 80 percent."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? **Change the Test menu to one-tailed.** The critical value moves left, the blue area grows, and power goes up. --- class: title title-8 # One tail adds power on that side <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=power&n=10&d=0.89&tails=one" title="Simulator's power view for a one-tailed test with d of 0.89 and n of 10. There's one critical value, closer to H0 than before. Power reads 88 percent." loading="lazy"></iframe> <img class="sim-static" src="img/sim/55be7972f62a.png" alt="Simulator's power view for a one-tailed test with d of 0.89 and n of 10. There's one critical value, closer to H0 than before. Power reads 88 percent."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? The answer is A. Power goes from 80% to 88%. The simulator reads 1.64 as the critical z, because the exact value is 1.645. The book rounds up to 1.65. --- layout: true class: title title-1 --- # So why not always use one tail? .box-inv-1.small.sp-after-half[A one-tailed test is blind on the other side. If the program hurts students, it can't say so] .box-inv-1.small.sp-after-half[You must pick the side before you see the data. Picking it afterward is really a test at α = 0.10] .box-1.small[Two tails is our default from now on, unless a problem says otherwise] ??? The second point is the one to land. If you look first and then put all of α on the side the data went, you've quietly doubled your Type I error rate. --- layout: false class: center middle section-title section-title-6 animated fadeIn # When we don't know σ --- layout: true class: title title-6 --- # So far, z has needed σ <div class="math-display">\[ z = \frac{M - \mu}{\sigma_M} \qquad \text{where} \qquad \sigma_M = \frac{\sigma}{\sqrt{n}} \]</div> .pull-left[ .box-inv-6.small[Top: how far M is from the mean under H₀] ] .pull-right[ .box-inv-6.small[Bottom: how far a mean typically falls] ] .box-6.small[All quarter, someone has told us σ = 15. Who told us?] ??? The standard error's second job from Topic 6: how surprising is this mean, if H₀ is true? In real research nobody hands us σ. --- # Here's one sample of 10, with σ known <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=2&n=10&view=stat&draws=1&seed=258921" title="Simulator at step 2 with one sample of ten people drawn. Panel 1 shows the normal population with mean 100 and SD 15. Panel 2 shows the sample, with a mean of 105.5 and a z of 1.17. Panel 3 holds one dot at that z, inside the cutoffs." loading="lazy"></iframe> <img class="sim-static" src="img/sim/749a7017c6ca.png" alt="Simulator at step 2 with one sample of ten people drawn. Panel 1 shows the normal population with mean 100 and SD 15. Panel 2 shows the sample, with a mean of 105.5 and a z of 1.17. Panel 3 holds one dot at that z, inside the cutoffs."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? This is step 2 of the blueprint. M is 105.5, z is 1.17, and p is 0.24. About a quarter of samples land this far out, or farther, so it isn't surprising. All of this used σ = 15, from panel 1. --- # In real research, panel 1 goes dark <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=3&n=10&draws=1&hide=1&seed=258921" title="Simulator at step 3a with the same sample of ten people. Panel 1 is greyed out and marked with a question mark. Panel 2 shows the same mean of 105.5, with an estimated SD of 11.5 and a t of 1.52. Panel 3 holds one dot at that t." loading="lazy"></iframe> <img class="sim-static" src="img/sim/dd2f70ae8f95.png" alt="Simulator at step 3a with the same sample of ten people. Panel 1 is greyed out and marked with a question mark. Panel 2 shows the same mean of 105.5, with an estimated SD of 11.5 and a t of 1.52. Panel 3 holds one dot at that t."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? Same seed, same ten people, same M. This is step 3a. Panel 1 is greyed out, because we can't see the population. It's the picture version of the hat: we've lost σ, so we estimate it from panel 2. Here σ̂ is 11.55, lower than the true 15. So the standard error shrinks, and the score rises from 1.17 to 1.52. Nothing about the sample changed. Only what we know changed. --- # So σ̂ takes the place of σ <div class="math-display">\[ z = \frac{M - \mu}{\sigma_M} \qquad \text{becomes} \qquad t = \frac{M - \mu}{\hat{\sigma}_M} \]</div> .pull-left[ .box-inv-6.small[Only the bottom changes: σ̂<sub>M</sub> = σ̂ / √n. The hat says it's an estimate] ] .pull-right[ .box-inv-6.small[The new name warns us: this score behaves a little differently] ] .book-tag[In the book: σ̂ is written s, and σ̂<sub>M</sub> is written s<sub>M</sub>] ??? Greek means population. A Latin letter or a hat means an estimate. μ here is still the value H₀ claims. We haven't seen it either, but we've said what it would be. --- # Dividing by n − 1 fixes the variance <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Samples of 5 from our 619 students </th> <th style="text-align:center;"> Average across samples </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> The sample's own variance, SS / n </td> <td style="text-align:center;"> 12.13 </td> </tr> <tr> <td style="text-align:left;"> Our estimate, σ̂² = SS / (n − 1) </td> <td style="text-align:center;"> 15.17 </td> </tr> <tr> <td style="text-align:left;"> The truth, σ² </td> <td style="text-align:center;"> 15.22 </td> </tr> </tbody> </table> .box-inv-6.small.sp-after-half[SS / n tends to underestimate σ². Dividing by n − 1 gives an unbiased estimate of the variance] .box-6.small[Then σ̂ is its square root. From here on, n − 1 is the degrees of freedom: df] .source[Data: Muralidharan, Singh, and Ganimian (2019). 100,000 samples.] ??? A reminder from Topic 3. "Tends to", not "always": some samples overshoot. And it's the variance estimate that's unbiased. Taking the square root makes σ̂ run a little low: here it averages 3.64 against a true σ of 3.90. Say that only if someone asks. --- layout: false class: title title-8 poll-slide # Predict it: Does swapping in σ̂ matter? .poll-respond[Respond at **PollEv.com/adb**] .box-inv-8.small[ Treat our 619 students as a population. Draw samples of 5, and use σ̂ in place of σ. With the true σ, 5% of samples land beyond ±1.96. With σ̂? ] .options[ .option[ **A** Much less than 5% ] .option[ **B** About 5%, the same ] .option[ **C** More than 5% ] .option[ **D** It depends on μ ] ] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes. Vote, turn to a neighbor, vote again, then show the answer. Andy: create this poll in Poll Everywhere, then add the `.poll-bar` button from EDUC 265's 06-01 with its presenter id. --- class: title title-8 poll-answer # Predict it: Answer .options[ .option.wrong[ **A** Much less than 5% ] .option.wrong[ **B** About 5%, the same ] .option.correct[ **C** More than 5% ] .option.wrong[ **D** It depends on μ ] ] .box-inv-8.small.sp-after-half[ With samples of 5, it's 12%, more than twice the 5% we signed up for ] .box-8.small[ If we kept using ±1.96, we'd make far too many Type I errors ] --- layout: true class: title title-6 --- # Small samples bring too many surprises <img src="08-t-test_files/figure-html/beyond-plot-1.png" alt="Bar chart of the share of samples beyond plus or minus 1.96, for samples of 5, 25 and 100, with a dashed line at 5 percent. With the true sigma, every bar is at about 5 percent. With sigma hat, the share is 11.8% at n of 5, 6.1% at n of 25 and 5.3% at n of 100." width="84%" style="display: block; margin: auto;" /> .box-inv-6.small[As n grows, σ̂ gets closer to σ, and the problem fades] .source[Data: Muralidharan, Singh, and Ganimian (2019). 100,000 samples of each size.] ??? Same scores, same samples, same cutoff. The only difference is what's in the bottom of the fraction. The dashed line is the 5% we promised. --- # Why? σ̂ bounces, and often lands low <img src="08-t-test_files/figure-html/sd-hat-plot-1.png" alt="Histogram of sigma hat across samples of 5 math scores, spread widely from about 1 to 7, with a dashed line at the true sigma of 3.90. About 60% of the samples fall below the line." width="84%" style="display: block; margin: auto;" /> .box-inv-6.small[60% of samples give a σ̂ below σ. Then the bottom shrinks and the score grows] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? With z, the bottom is a fixed number. With t, the bottom changes from sample to sample. That extra wobble is what pushes more scores out into the tails. --- layout: false class: center middle section-title section-title-3 animated fadeIn # The t-test --- layout: true class: title title-3 --- # With n = 5, the pile has fatter tails <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=3&n=5&draws=5000&hide=1&seed=258921" title="Simulator at step 3a with 5,000 samples of five people and panel 1 greyed out. Panel 3 shows the t-scores stacked along a dashed t curve with 4 degrees of freedom, with cutoffs at minus 2.78 and 2.78." loading="lazy"></iframe> <img class="sim-static" src="img/sim/10970ec2d6c7.png" alt="Simulator at step 3a with 5,000 samples of five people and panel 1 greyed out. Panel 3 shows the t-scores stacked along a dashed t curve with 4 degrees of freedom, with cutoffs at minus 2.78 and 2.78."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? Panel 3 no longer uses the normal curve. It's a t curve with n − 1 = 4 degrees of freedom. The cutoffs moved out from ±1.96 to ±2.78, so about 5% of samples land beyond them again. The readout also shows how many land beyond ±1.96: far more than 5%. Drag n up, press +500, and watch the cutoffs come back toward 1.96. --- # Fewer degrees of freedom, fatter tails <img src="08-t-test_files/figure-html/t-curves-1.png" alt="Four panels, each comparing a t curve with the normal curve, for 2, 4, 9 and 29 degrees of freedom. The t curve is lower in the middle and higher in the tails than the normal curve. The gap shrinks as degrees of freedom rise. The two-tailed 5 percent cutoffs are 4.30, 2.78, 2.26 and 2.05." width="94%" style="display: block; margin: auto;" /> .box-inv-3.small[A family of curves, one for each df. Near df = 30, it's hard to tell from z] ??? Why df and not n? It's n − 1, the number we divided by to get σ̂. The more df, the better σ̂ is, and the closer t gets to z. These curves replace the rpsychologist screenshots from 2024. --- # Each df has its own cutoff <table class="deck-table tight"> <thead> <tr> <th style="text-align:center;"> df </th> <th style="text-align:center;"> Two tails, α = 0.05 </th> <th style="text-align:center;"> One tail, α = 0.05 </th> <th style="text-align:center;"> Two tails, α = 0.01 </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 4 </td> <td style="text-align:center;"> 2.776 </td> <td style="text-align:center;"> 2.132 </td> <td style="text-align:center;"> 4.604 </td> </tr> <tr> <td style="text-align:center;"> 9 </td> <td style="text-align:center;"> 2.262 </td> <td style="text-align:center;"> 1.833 </td> <td style="text-align:center;"> 3.250 </td> </tr> <tr> <td style="text-align:center;"> 14 </td> <td style="text-align:center;"> 2.145 </td> <td style="text-align:center;"> 1.761 </td> <td style="text-align:center;"> 2.977 </td> </tr> <tr> <td style="text-align:center;"> <strong>24</strong> </td> <td style="text-align:center;"> <strong>2.064</strong> </td> <td style="text-align:center;"> <strong>1.711</strong> </td> <td style="text-align:center;"> <strong>2.797</strong> </td> </tr> <tr> <td style="text-align:center;"> 60 </td> <td style="text-align:center;"> 2.000 </td> <td style="text-align:center;"> 1.671 </td> <td style="text-align:center;"> 2.660 </td> </tr> <tr> <td style="text-align:center;"> 120 </td> <td style="text-align:center;"> 1.980 </td> <td style="text-align:center;"> 1.658 </td> <td style="text-align:center;"> 2.617 </td> </tr> <tr> <td style="text-align:center;"> Very large (z) </td> <td style="text-align:center;"> 1.960 </td> <td style="text-align:center;"> 1.645 </td> <td style="text-align:center;"> 2.576 </td> </tr> </tbody> </table> .box-3.small[In practice, people use t at any n. With large samples it barely differs from z] .book-tag[The full t table is in the book's appendix, and comes with the exams] ??? Show how to read it: pick the column from the tails and α, and the row from df. If the book's table skips your df, use the next lower df, which is the cautious choice. The test also assumes independent observations and a roughly normal population. With larger samples, normality matters less, thanks to the central limit theorem. --- # One example, with and without σ .box-inv-3.small[n = 25, M = 106, SS = 6,144. H₀: μ = 100. α = 0.05, two tails] <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> Step </th> <th style="text-align:left;"> If we know σ = 15 </th> <th style="text-align:left;"> If we don't </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 1. State H₀ </td> <td style="text-align:left;"> μ = 100 </td> <td style="text-align:left;"> μ = 100 </td> </tr> <tr> <td style="text-align:left;"> 2. Set the criteria </td> <td style="text-align:left;"> z beyond ±1.96 </td> <td style="text-align:left;"> t(24) beyond ±2.064 </td> </tr> <tr> <td style="text-align:left;"> 3. Find the spread </td> <td style="text-align:left;"> σ<sub>M</sub> = 15 / √25 = 3.00 </td> <td style="text-align:left;"> σ̂ = √(6,144 / 24) = 16<br>σ̂<sub>M</sub> = 16 / √25 = 3.20 </td> </tr> <tr> <td style="text-align:left;"> 3. Compute the score </td> <td style="text-align:left;"> z = 6 / 3 = 2.00 </td> <td style="text-align:left;"> t = 6 / 3.2 = 1.875 </td> </tr> <tr> <td style="text-align:left;"> 4. Decide </td> <td style="text-align:left;"> Reject H₀: 2.00 > 1.96 </td> <td style="text-align:left;"> Maintain H₀: 1.875 < 2.064 </td> </tr> </tbody> </table> ??? Andy's example from 2024. Go down one column, then the other. The steps are the same, and only the numbers in steps 2 and 3 change. --- # Same sample, different decisions <img src="08-t-test_files/figure-html/decision-plot-1.png" alt="Two curves with shaded tails. On the left, the normal curve has cutoffs at plus or minus 1.96, and our z of 2.00 lands in the shaded tail. On the right, a t curve with 24 degrees of freedom has cutoffs at plus or minus 2.064, and our t of 1.875 lands just short of the shaded tail." width="92%" style="display: block; margin: auto;" /> .pull-left[ .box-inv-3.small[The score fell: σ̂ = 16 is above 15] ] .pull-right[ .box-inv-3.small[The cutoff rose: 2.064 is above 1.96] ] .box-3.small[We report: t(24) = 1.88, p = 0.07. We maintain H₀] ??? Two things moved, and both worked against rejecting. Maintaining H₀ doesn't mean H₀ is true. It means this sample isn't surprising enough. The first number in brackets is always df. With σ known, p would be 0.046. --- layout: false class: title title-8 # Try it: A real group of students .box-inv-8.small.sp-after-half[24 Mindspark students take 2 to 3 hours a week of extra math lessons, called tuition in India. At baseline: M = 12.21, SS = 282.0] .box-8.small.sp-after-half[Test H₀: μ = 11.12, the mean of all 619 students. Use α = 0.05 and two tails. The cutoff is t(23) = ±2.069] .box-inv-8.small[Find σ̂, σ̂<sub>M</sub> and t, then decide. Work alone, compare with a neighbor, then we vote] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes, with calculators. Vote with hands on the decision: reject or maintain. Common slips: dividing SS by n, or using n in place of n − 1 for df. --- class: title title-8 # Try it: Answer .pull-left[ .box-inv-8.small[σ̂ = √(282.0 / 23) = **3.50**] .box-inv-8.small[σ̂<sub>M</sub> = 3.50 / √24 = **0.715**] ] .pull-right[ .box-inv-8.small[t = (12.21 − 11.12) / 0.715 = **1.52**] .box-inv-8.small[1.52 is inside ±2.069: **maintain H₀**] ] .box-8.small[We report: t(23) = 1.52, p = 0.14. These 24 students aren't surprisingly far from 11.12] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? Keep these 24 students in mind. They come back on Tuesday. --- class: title title-8 # Before Tuesday .box-inv-8.medium.sp-after-half[Friday, February 5: Lab 5, power and the one-sample t-test. Bring a calculator and a laptop] .box-inv-8.medium.sp-after-half[Sunday, February 7 at 6 PM: Mastery and Problem Set for Chapter 8] .box-8.medium[Read section 9-3 for Tuesday] ??? Lab 5 practises today's one-sample t by hand, and power on the simulator from Topic 7. Chapter 9's homework comes after Tuesday's class, on February 14. --- name: session-2 class: title title-8 # Session 2: Tuesday, February 9 .box-inv-8.small.sp-after-half[Thursday in one line: when we estimate σ, z becomes t, and cutoffs depend on df] .box-5.medium.sp-after-half[How big is the effect?] .box-7.medium.sp-after-half[Confidence intervals] .box-4.medium[Intervals and tests] ??? Three blocks today, and then what to expect on the midterm. A test gives a yes or no. Today we ask for more than that. --- layout: false class: center middle section-title section-title-5 animated fadeIn # How big is the effect? --- layout: true class: title title-5 --- # d says how far apart, in SDs <img src="08-t-test_files/figure-html/d-plot-1.png" alt="Two normal curves with the same spread. One is centered at 100, the mean under H0, and the other at 113.4, the true mean. An arrow between their centers is labeled d equals 0.89." width="84%" style="display: block; margin: auto;" /> .box-inv-5.small[Cohen's d = (true μ − H₀ μ) / σ = (113.4 − 100) / 15 = 0.89. It's a parameter: it doesn't depend on n] ??? A review from Topic 7. d is a z-score for a difference: the gap, in standard deviations. Population values all the way through, so d is a population quantity. In the simulator, a slider sets it. Here again, how do we know that σ? We usually don't. --- # Hedges' g is the estimate of d <div class="math-display">\[ d = \frac{\mu_{\text{true}} - \mu}{\sigma} \qquad \text{is estimated by} \qquad g = \frac{M - \mu}{\hat{\sigma}} \]</div> .box-inv-5.small.sp-after-half[In our example: g = (106 − 100) / 16 = **0.375**, so the mean sits about four tenths of an SD above H₀] .box-5.small[Cohen's rough guide: 0.2 is small, 0.5 is medium, and 0.8 is large] .book-tag[In the book: g is called the estimated Cohen's d. The book also covers r² here: skip it for now, we come back to it] ??? Same hat logic: a Latin letter for an estimate. g uses σ̂, not σ̂<sub>M</sub>. It measures distance in people's SDs, not in standard errors, which is why n isn't in the formula. Some software applies a small-sample correction and also calls that g. We don't. We return to the variance-explained idea, r², in the ANOVA and regression topics. --- layout: false class: title title-8 poll-slide # Predict it: Four times the people .poll-respond[Respond at **PollEv.com/adb**] .box-inv-8.small[ Our example has n = 25, M = 106 and σ̂ = 16, so t = 1.875 and g = 0.375. Now keep M and σ̂, and make n = 100. What happens? ] .options[ .option[ **A** t and g both go up ] .option[ **B** t goes up, and g stays the same ] .option[ **C** g goes up, and t stays the same ] .option[ **D** Neither changes ] ] ??? About 6 minutes. Vote, turn to a neighbor, vote again, then show the answer. Andy: create this poll in Poll Everywhere, then add the `.poll-bar` button from EDUC 265's 06-01 with its presenter id. --- class: title title-8 poll-answer # Predict it: Answer .options[ .option.wrong[ **A** t and g both go up ] .option.correct[ **B** t goes up, and g stays the same ] .option.wrong[ **C** g goes up, and t stays the same ] .option.wrong[ **D** Neither changes ] ] .box-inv-8.small.sp-after-half[ σ̂<sub>M</sub> falls from 3.2 to 1.6, so t doubles to 3.75. Now we reject H₀. But g is still 0.375 ] .box-8.small[ The effect is the same size. We just have a sharper view of it ] --- layout: true class: title title-5 --- # Similar effect, different decision <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Group </th> <th style="text-align:center;"> n </th> <th style="text-align:center;"> M </th> <th style="text-align:center;"> g </th> <th style="text-align:center;"> t </th> <th style="text-align:center;"> p </th> <th style="text-align:center;"> Decision </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 2 to 3 hours of tuition </td> <td style="text-align:center;"> 24 </td> <td style="text-align:center;"> 12.21 </td> <td style="text-align:center;"> 0.31 </td> <td style="text-align:center;"> 1.52 </td> <td style="text-align:center;"> 0.142 </td> <td style="text-align:center;"> Maintain H₀ </td> </tr> <tr> <td style="text-align:left;"> More than 4 hours </td> <td style="text-align:center;"> 81 </td> <td style="text-align:center;"> 12.46 </td> <td style="text-align:center;"> 0.35 </td> <td style="text-align:center;"> 3.11 </td> <td style="text-align:center;"> 0.003 </td> <td style="text-align:center;"> Reject H₀ </td> </tr> </tbody> </table> .box-inv-5.small.sp-after-half[Both groups sit about a third of an SD above 11.12. Only the larger group is significant] .box-5.small.sp-after-half[Significant means "hard to explain by sampling error". It doesn't mean big] .box-inv-5.small[These families chose tuition, so neither test shows that tuition works] .source[Data: Muralidharan, Singh, and Ganimian (2019). H₀: μ = 11.12, α = 0.05, two tails.] ??? The first row is Thursday's try-it. The two values of g are close, and the decisions differ, because one group has more than three times the people. The last box matters. Stronger students may be the ones whose families pay for tuition. That's the difference between prediction and explanation, and it's why the lottery matters in Mindspark. --- layout: false class: center middle section-title section-title-7 animated fadeIn # Confidence intervals --- layout: true class: title title-7 --- # You already know the margin of error .box-7.medium.sp-after-half[A poll: 52% say yes, ± 3 points] .box-inv-7.small.sp-after-half[Election polls report one, and charts draw it as a band around the line] .box-inv-7.small.sp-after-half[It's about two standard errors: how far off this estimate might be] .box-7.small[That's the standard error's first job from Topic 6. Now, for a mean] ??? The poll is the made-up one from Topic 6. This replaces 2024's election screenshots. Topic 6 started from μ and asked where means land. Now we don't know μ, so we start from what we have, M, and go out from there. --- # An interval: estimate ± margin of error <div class="math-display">\[ M \pm z \, \sigma_M \qquad \text{or} \qquad M \pm t \, \hat{\sigma}_M \]</div> .pull-left[ .box-inv-7.small[σ known: z = 1.96 for a 95% interval] ] .pull-right[ .box-inv-7.small[σ unknown: t from the table, n − 1 df] ] .box-7.small[Use the two-tailed 5% cutoff. Margin of error = cutoff × standard error] .book-tag[In the book: the second one is M ± t s<sub>M</sub>] ??? Same ingredients as the test: M, a cutoff and a standard error. They're only arranged differently. The test centers on H₀'s μ. The interval centers on M. --- # Our example: from 99.40 to 112.60 <img src="08-t-test_files/figure-html/ci-plot-1.png" alt="A number line of possible values of the population mean, with a point at the sample mean of 106 and a bar running from 99.40 to 112.60." width="84%" style="display: block; margin: auto;" /> .box-inv-7.small.sp-after-half[106 ± 2.064 × 3.2 = 106 ± 6.60] .box-7.small[We're 95% confident that μ is between 99.40 and 112.60] ??? Thursday's example: n = 25, σ̂ = 16, df = 24. Every value in that range is a value of μ that this sample can't rule out. --- layout: false class: title title-8 press-slide # Each sample gets its own interval <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=intervals&n=25&level=0.95&known=0&draws=1&seed=5" title="Simulator's confidence interval view with one interval drawn from a sample of 25, around a vertical line at the true mean of 100." loading="lazy"></iframe> <img class="sim-static" src="img/sim/f0bbc3d7b46a.png" alt="Simulator's confidence interval view with one interval drawn from a sample of 25, around a vertical line at the true mean of 100."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? **Press +1 a few times, then +50.** Each row is one sample, with its own M, its own σ̂ and so its own width. The vertical line is μ. It doesn't move. Intervals that miss it turn red, with a square marker. --- layout: true class: title title-7 --- # About 95% of the intervals catch μ <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=intervals&n=25&level=0.95&known=0&draws=500&seed=5" title="Simulator's confidence interval view with 500 intervals drawn from samples of 25, with the latest 60 shown. Nearly all of them cross the vertical line at the true mean of 100, and a few miss it and carry a square marker." loading="lazy"></iframe> <img class="sim-static" src="img/sim/1471ebda189e.png" alt="Simulator's confidence interval view with 500 intervals drawn from samples of 25, with the latest 60 shown. Nearly all of them cross the vertical line at the true mean of 100, and a few miss it and carry a square marker."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? Read "Contain μ" in the panel. Widths differ here, because each interval uses its own σ̂. Set Population SD to Known and they'd all have the same width. --- # What the 95% describes .box-7.small.sp-after-half[The method: across many samples, about 95% of the intervals contain μ] .box-inv-7.small.sp-after-half[μ stays put. It's the interval that moves from sample to sample] .box-inv-7.small.sp-after-half[Our one interval either holds μ or it doesn't. We can't tell which] .box-inv-7.small[On real scores: 94.9% of 5,000 intervals from samples of 25 contain our 619 students' μ = 11.12] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? The precise wording is about repeated sampling, so "we're 95% confident" is shorthand for that. The last box uses samples with replacement from the 619 scores. They aren't normal, and the method still works. --- layout: false class: title title-8 # Predict it: Ask for more confidence .box-inv-8.small.sp-after-half[We have a 95% interval from 99.40 to 112.60. We want 99% instead, with the same sample] .box-8.small[What happens to the interval?] .options[ .option[ **A** It gets narrower ] .option[ **B** It gets wider ] .option[ **C** It stays the same ] .option[ **D** It shifts to the right ] ] ??? About 6 minutes for this slide and the next two. Hands are fine. Neighbor first, then vote. Ask for a reason: what would you do to be more sure of catching something? --- class: title title-8 press-slide # Predict it: Change the confidence level <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=intervals&n=25&level=0.95&known=0&draws=60&seed=5" title="Simulator's confidence interval view with 60 intervals from samples of 25 at a 95 percent level, ready for the level to be changed." loading="lazy"></iframe> <img class="sim-static" src="img/sim/58f9a5f429fc.png" alt="Simulator's confidence interval view with 60 intervals from samples of 25 at a 95 percent level, ready for the level to be changed."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? **Change Confidence level to 99%, then press +50.** The intervals get wider, and the readout's margin of error grows. Then try dragging n up and pressing +50: they narrow. --- class: title title-8 # Predict it: More confidence costs width <table class="deck-table tight"> <thead> <tr> <th style="text-align:center;"> Confidence </th> <th style="text-align:center;"> n </th> <th style="text-align:center;"> Cutoff t </th> <th style="text-align:center;"> Margin of error </th> <th style="text-align:center;"> Interval </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 90% </td> <td style="text-align:center;"> 25 </td> <td style="text-align:center;"> 1.711 </td> <td style="text-align:center;"> 5.47 </td> <td style="text-align:center;"> [100.53, 111.47] </td> </tr> <tr> <td style="text-align:center;"> 95% </td> <td style="text-align:center;"> 25 </td> <td style="text-align:center;"> 2.064 </td> <td style="text-align:center;"> 6.60 </td> <td style="text-align:center;"> [99.40, 112.60] </td> </tr> <tr> <td style="text-align:center;"> 99% </td> <td style="text-align:center;"> 25 </td> <td style="text-align:center;"> 2.797 </td> <td style="text-align:center;"> 8.95 </td> <td style="text-align:center;"> [97.05, 114.95] </td> </tr> <tr> <td style="text-align:center;"> 95% </td> <td style="text-align:center;"> 100 </td> <td style="text-align:center;"> 1.984 </td> <td style="text-align:center;"> 3.17 </td> <td style="text-align:center;"> [102.83, 109.17] </td> </tr> </tbody> </table> .box-inv-8.small.sp-after-half[The answer is B. To be more sure of catching μ, cast a wider net] .box-8.small[More people buy the width back: the last row is 95% with n = 100, same M and σ̂] ??? The center stays at M. Only the margin changes. Compare the second and last rows: four times the people, about half the margin. It isn't exactly half, because the cutoff also falls a little. --- layout: false class: center middle section-title section-title-4 animated fadeIn # Intervals and tests --- layout: true class: title title-4 --- # An interval can run the test for you <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Step </th> <th style="text-align:left;"> If we know σ = 15 </th> <th style="text-align:left;"> If we don't </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 1. State H₀ </td> <td style="text-align:left;"> μ = 100 </td> <td style="text-align:left;"> μ = 100 </td> </tr> <tr> <td style="text-align:left;"> 2. Set the criteria </td> <td style="text-align:left;"> 95% interval, z = 1.96 </td> <td style="text-align:left;"> 95% interval, t(24) = 2.064 </td> </tr> <tr> <td style="text-align:left;"> 3. Build the interval </td> <td style="text-align:left;"> 106 ± 1.96 × 3.00<br>[100.12, 111.88] </td> <td style="text-align:left;"> 106 ± 2.064 × 3.20<br>[99.40, 112.60] </td> </tr> <tr> <td style="text-align:left;"> 4. Decide </td> <td style="text-align:left;"> Reject H₀: 100 isn't inside </td> <td style="text-align:left;"> Maintain H₀: 100 is inside </td> </tr> </tbody> </table> .box-4.small[A 95% interval that leaves out the H₀ mean means rejecting H₀ at α = 0.05, two tails] ??? Same example, same decisions as Thursday. It has to work out this way: M is more than a margin away from μ exactly when the score is beyond the cutoff. The level has to match: a 95% interval goes with a two-tailed test at α = 0.05, and a 99% interval with α = 0.01. --- # Only one interval leaves out 100 <img src="08-t-test_files/figure-html/two-ci-plot-1.png" alt="Two horizontal confidence intervals around a mean of 106, with a dashed vertical line at the H0 mean of 100. With sigma known, the interval runs from 100.12 to 111.88 and stops just right of the line. With sigma unknown, it runs from 99.40 to 112.60 and crosses the line." width="84%" style="display: block; margin: auto;" /> .box-inv-4.small[The t interval is wider, for two reasons: a bigger σ̂ and a bigger cutoff] ??? The left end of the first interval only just clears 100. That's why z was only just past 1.96. --- # With a real effect, intervals miss H₀ <div class="sim-slide" style="height: 505px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=intervals&n=25&level=0.95&known=0&d=0.4&draws=500&seed=5" title="Simulator's confidence interval view with 500 intervals from samples of 25 and a true effect d of 0.4. A solid line marks the true mean of 106, and a dashed line marks the H0 mean of 100. Many intervals stop short of the dashed line, which means rejecting H0." loading="lazy"></iframe> <img class="sim-static" src="img/sim/04f11d470926.png" alt="Simulator's confidence interval view with 500 intervals from samples of 25 and a true effect d of 0.4. A solid line marks the true mean of 106, and a dashed line marks the H0 mean of 100. Many intervals stop short of the dashed line, which means rejecting H0."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? Here the true effect is d = 0.4, so the true mean really is 106, our example's M. The solid line is the truth, and the dashed line is what H₀ claims. "Exclude the H₀ mean: reject H₀" is the share of samples that reject. That's power. Our example's sample is one of the many whose interval still holds 100, so maintaining H₀ there was a Type II error in this world. Drag n up to watch the share climb. --- layout: false class: title title-8 # Try it: The 24 students again .box-inv-8.small.sp-after-half[n = 24, M = 12.21, σ̂ = 3.50, σ̂<sub>M</sub> = 0.715, H₀: μ = 11.12, cutoff t(23) = 2.069] .box-8.small.sp-after-half[Find g, then a 95% confidence interval] .box-inv-8.small[Does the interval hold 11.12? Does that match Thursday's decision? Work alone, compare with a neighbor, then we vote] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes, with calculators. The numbers are Thursday's. Vote with hands on the last question. --- class: title title-8 # Try it: Answer .pull-left[ .box-inv-8.small[g = (12.21 − 11.12) / 3.50 = **0.31**] ] .pull-right[ .box-inv-8.small[12.21 ± 2.069 × 0.715 = **[10.73, 13.69]**] ] .box-8.small.sp-after-half[The interval holds 11.12, so we maintain H₀, the same decision as Thursday] .box-inv-8.small[The interval also says what the test didn't: μ could be a bit below 11.12, or as much as 2.6 points above it] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? A wide interval is a useful warning. With only 24 students, "maintain" says we can't tell, not that there's no gap. --- class: title title-8 # One sample, three answers .pull-left-3[ .box-1.medium[The t-test] .center.small[Is this mean surprising under H₀?] .center[t(23) = 1.52] ] .pull-middle-3[ .box-6.medium[Effect size] .center.small[How big is the gap, in SDs?] .center[g = 0.31] ] .pull-right-3[ .box-3.medium[The interval] .center.small[Which values of μ fit the data?] .center[[10.73, 13.69]] ] .box-inv-8.small[Report all three. Each one says something the others don't] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? These are the 24 students once more. From here on, every t-test in the course comes with an effect size and an interval. --- class: title title-8 # The blueprint so far <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Blueprint step </th> <th style="text-align:center;"> Statistic </th> <th style="text-align:center;"> Bottom of the fraction </th> <th style="text-align:center;"> In the book </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 1. One score </td> <td style="text-align:center;"> z </td> <td style="text-align:center;"> σ </td> <td style="text-align:center;"> σ </td> </tr> <tr> <td style="text-align:left;"> 2. One mean, σ known </td> <td style="text-align:center;"> z </td> <td style="text-align:center;"> σ<sub>M</sub> </td> <td style="text-align:center;"> σ<sub>M</sub> </td> </tr> <tr> <td style="text-align:left;"> 3a. One mean, σ unknown </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> σ̂<sub>M</sub> </td> <td style="text-align:center;"> s<sub>M</sub> </td> </tr> <tr> <td style="text-align:left;"> 4. Two means: next </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> Topic 9 </td> <td style="text-align:center;"> </td> </tr> </tbody> </table> .box-8.small[Same three panels: population, one sample, the statistic across samples] ??? Each step is the same fraction: an observed gap over the gap we'd expect from sampling error. Panel 1 went dark at step 3a. It goes dark whenever we do real research, because we can't see the population. --- class: title title-8 # What you can do now .box-inv-8.small[Choose one tail or two, and say what each costs] .box-inv-8.small[Say why σ̂ gives us t, not z, and why df matters] .box-inv-8.small[Run a one-sample t-test by hand, from n, M and SS] .box-inv-8.small[Compute Hedges' g, and tell significance from size] .box-inv-8.small[Build a confidence interval, and use it to test H₀] --- class: title title-8 # The midterm: what to expect .box-8.medium.sp-after-half[Tuesday, February 16, in class, 80 minutes] .box-inv-8.small.sp-after-half[It covers Chapters 1 to 9, which are Topics 1 to 8] .box-inv-8.small.sp-after-half[It's free response: show your work and explain your thinking] .box-inv-8.small.sp-after-half[Open book: bring any print materials, and your own notes] .box-inv-8.small.sp-after-half[We attach tables and a formula sheet, in both sets of symbols] .box-inv-8.small[A calculator is the only device you can use] ??? General format only. No exam content in this deck, since it's public. --- class: title title-8 # Next steps .pull-left[ .box-1.small[Thursday, February 11: Midterm review] Practice problems in pairs. Bring a calculator and your questions ] .pull-right[ .box-6.small[Friday, February 12: Lab 6] Quiz, as midterm review. Bring a calculator ] .box-3.small[Sunday, February 14 at 6 PM: Mastery and Problem Set for Chapter 9. The midterm is Tuesday, February 16] <style type="text/css"> /* Images sit under the title. These heights leave room for a source line */ .picture img { display: block; margin: 0 auto; max-width: 100%; max-height: 440px; } .picture-small img { display: block; margin: 0 auto; max-width: 100%; max-height: 230px; } .anteater img { display: block; margin: 0.15em auto 0; max-height: 105px; } /* This chunk sits at the end because any output before the first slide's "class:" line stops remark from reading that slide's properties */ /* Long titles get two smaller lines inside the 110 px title bar */ .remark-slide-content.long-title h1 { font-size: 1.05em; line-height: 1.05; margin-top: -100px; margin-bottom: 55px; } .source { position: absolute; bottom: 18px; left: 60px; font-size: 0.55em; color: #47505a; } .book-tag { margin-top: 0.7em; font-size: 0.65em; color: #47505a; text-align: right; } table.deck-table { width: 92%; margin: 0.4em auto; border-collapse: collapse; font-size: 0.72em; } table.deck-table.tight td, table.deck-table.tight th { padding: 0.12em 0.6em; } table.deck-table th { border-bottom: 2px solid #244a70; padding: 0.3em 0.6em; } table.deck-table td { border-bottom: 1px solid #c9d1d9; padding: 0.3em 0.6em; } .options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35em 1em; margin-top: 0.6em; margin-bottom: 0.8em; font-size: 0.65em; } .option { background-color: #f3f3f3; border: 2px solid #cccccc; padding: 0.35em 0.6em; } .option.correct { background-color: #b18323; border-color: #b18323; color: white; } .option.wrong { opacity: 0.6; } .poll-respond { display: block; font-size: 0.5em; text-align: center; margin-top: 0.1em; } /* The printed PDF keeps the question and drops the answer slide. A slide that waits for a live button press would print empty, so it goes too */ @media print { .remark-slide-container:has(.poll-answer), .remark-slide-container:has(.press-slide) { display: none !important; } } </style>