class: center middle main-title section-title-4 # Regression: is the slope real? .class-info[ **Topic 13 · Tuesday, March 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] .box-inv-6.small[Does one score go with another?] .box-inv-6.small[Use one score to predict another] .box-inv-6.small[Is the slope real?] .here-row[ **We are here** .anteater[] ] ] .pull-right-3[ .box-3.medium[Explanation] ] .source[Peter the Anteater at a UC Irvine basketball game.] ??? Same map. On Thursday we found a line. Today we ask whether its slope could be a fluke of the sample. It's the last new statistic in our blueprint. --- class: title title-8 # Same four steps, one new statistic .box-inv-8.small.sp-after-half[Step 1: State a hypothesis about the slope in the population] .box-inv-8.small.sp-after-half[Step 2: Set the criteria: how far from 0 must our slope be to count as unexpected?] .box-8.small.sp-after-half[Step 3: Observe a sample and find b. How unexpected is it, if the true line is flat?] .box-inv-8.small[Step 4: Reject or maintain H₀] ??? The same four steps as z, t and F. Step 3 gets a new standard error, and that's most of what's new today. --- name: outline class: title title-8 # Plan for today .box-1.medium.sp-after-half[A slope bounces] .box-6.medium.sp-after-half[Testing the slope] .box-3.medium.sp-after-half[F, r² and R's output] ??? Three blocks of about 20 minutes. Each ends with students doing something: predict, try, play. The running question is still whether baseline math predicts endline math. --- layout: false class: center middle section-title section-title-1 animated fadeIn # A slope bounces --- layout: true class: title title-1 --- # Eight students at a time, the line swings <img src="13-regression-inference_files/figure-html/swing-plot-1.png" alt="The scatter plot of 539 students in pale dots, with baseline math on the horizontal axis and endline math on the vertical axis. A thick dark line shows their slope of 0.76. Thirty thin lines, one from each random sample of 8 students, cross it at many angles. Some are nearly flat, and others are much steeper." width="82%" style="display: block; margin: auto;" /> .box-inv-1.small[Treat our 539 students as a population. Each sample of 8 gets its own line] .source[Data: Muralidharan, Singh, and Ganimian (2019). Samples drawn by computer, with replacement. Dots are nudged.] ??? Thursday ended with three slopes: −2.50, 2.25 and 0.76. Same test, same schools. Here's why. Every thin line is a line we might have reported, if a different 8 students had landed in our sample. Each thin line only runs across its own sample's baseline scores. The short ones are samples with little spread in X, and they swing the most. Hold that thought for the poll. --- # β is the slope for everyone <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:center;"> Our estimate </th> <th style="text-align:center;"> In the population </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Mean </td> <td style="text-align:center;"> M </td> <td style="text-align:center;"> μ </td> </tr> <tr> <td style="text-align:left;"> Correlation </td> <td style="text-align:center;"> r </td> <td style="text-align:center;"> ρ </td> </tr> <tr> <td style="text-align:left;"> <strong>Slope</strong> </td> <td style="text-align:center;"> <strong>b</strong> </td> <td style="text-align:center;"> <strong>β</strong> </td> </tr> </tbody> </table> .box-1.small.sp-after-half[2.25 and 0.76 are values of b. Never call an estimate beta] .box-inv-1.small[A population line uses plain numbers, such as Y = 2.00 + 0.50X, so β = 0.50 here] .book-tag[Careful: in Topic 7, β was the Type 2 error rate. Here it's a slope. Same letter, different job] ??? The rule from Topic 3 again. Greek means population. The 2024 slides wrote "beta = 2.25", which was a slip: 2.25 is an estimate. We don't write α for the population's intercept, because α already has a job as well. --- # Same frame, new statistic <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> Blueprint step </th> <th style="text-align:left;"> Panel 1: population </th> <th style="text-align:left;"> Panel 2: one sample </th> <th style="text-align:left;"> Panel 3: many samples </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 2. One mean </td> <td style="text-align:left;"> A curve with μ </td> <td style="text-align:left;"> n scores, one M </td> <td style="text-align:left;"> A pile of M </td> </tr> <tr> <td style="text-align:left;"> 4. Two means </td> <td style="text-align:left;"> Two curves </td> <td style="text-align:left;"> Two groups, M₁ − M₂ </td> <td style="text-align:left;"> A pile of M₁ − M₂ </td> </tr> <tr> <td style="text-align:left;"> 5. Two or more means </td> <td style="text-align:left;"> Three curves </td> <td style="text-align:left;"> Three groups, one F </td> <td style="text-align:left;"> A pile of F </td> </tr> <tr> <td style="text-align:left;"> 6. A correlation </td> <td style="text-align:left;"> A cloud with ρ </td> <td style="text-align:left;"> n dots, one r </td> <td style="text-align:left;"> A pile of r </td> </tr> <tr> <td style="text-align:left;"> <strong>7a. A slope</strong> </td> <td style="text-align:left;"> <strong>A line with β</strong> </td> <td style="text-align:left;"> <strong>n dots, one b</strong> </td> <td style="text-align:left;"> <strong>A pile of b</strong> </td> </tr> </tbody> </table> .box-1.small[The three panels never change. Only the statistic does] ??? This is the blueprint from Topic 6, and it's the last new row. Panel 1 is what we can't see. Panel 2 is the one sample we get. Panel 3 is every sample we could have got. --- # Step 7a: Every sample draws its own line <div class="sim-slide" style="height: 495px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=7&n=8&d=0.5&a=2&view=raw&draws=551&seed=15" title="Simulator at step 7a with 551 samples of 8 pairs. Panel 1 shows a cloud around the population line Y = 2.00 + 0.50 X. Panel 2 shows one sample's 8 dots and its own line. Panel 3 shows the values of b piled up around 0.50, from below 0 to above 1." loading="lazy"></iframe> <img class="sim-static" src="img/sim/43f91e7ef29a.png" alt="Simulator at step 7a with 551 samples of 8 pairs. Panel 1 shows a cloud around the population line Y = 2.00 + 0.50 X. Panel 2 shows one sample's 8 dots and its own line. Panel 3 shows the values of b piled up around 0.50, from below 0 to above 1."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com. On your phone: [the simulator page](https://educ15.de-barros.com/resource/simulator.html).] ??? **Press +1 a few times.** A sample of 8 falls from panel 1 to panel 2, gets its own line, and one b drops into panel 3. Then press +50. Same story as M and r. The pile is centered on the true slope, 0.50. The population line is Y = 2.00 + 0.50X. It's in plain numbers, not in points on our test. Panel 3's axis fits itself to each preset, so read its numbers before comparing two views. --- # Our 8 students' b came from the far tail <img src="13-regression-inference_files/figure-html/pile-plot-1.png" alt="Histogram of b across 20,000 samples of 8 students, drawn from all 539. It's centered on 0.76, the slope of all students, and most values fall between −0.48 and 1.87. A red line at 2.25, the slope of our 8 students, sits far out in the right tail." width="82%" style="display: block; margin: auto;" /> .box-inv-1.small[The middle 95% runs from −0.48 to 1.87, and only 0.9% of samples reach 2.25. The SD of this pile is the standard error of b] .source[Data: Muralidharan, Singh, and Ganimian (2019). 20,000 samples of 8, drawn with replacement.] ??? The same pile, on our own students. Here we know the answer, because we're treating the 539 as the population, so β = 0.76. In real research, panel 1 goes dark, and one sample has to tell us how wide the pile is. That's the job of block 2. Students 25 to 32 aren't a random sample, just neighbors in a file. Their slope is high partly because their baseline scores sit so close together, which is the next point. --- layout: false class: title title-8 poll-slide # Predict it: Which slope bounces more? .poll-respond[Respond at **PollEv.com/adb**] .box-inv-8.small[ Two studies draw 30 Mindspark students, again and again. Study A takes any baseline score. Study B takes only baseline scores from 8 to 14. Whose b bounces more from sample to sample? ] .options[ .option[ **A** Study A ] .option[ **B** Study B ] .option[ **C** About the same ] .option[ **D** We can't tell without β ] ] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes for this slide and the next two. 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** Study A ] .option.correct[ **B** Study B ] .option.wrong[ **C** About the same ] .option.wrong[ **D** We can't tell without β ] ] .box-inv-8.small.sp-after-half[ Across 5,000 samples, b has an SD of 0.24 in Study A and 0.53 in Study B ] .box-8.small[ A line through a narrow band of X is like a seesaw on a short plank. Small bumps tip it a lot ] .source[Data: Muralidharan, Singh, and Ganimian (2019).] --- class: title title-8 # Predict it: Narrow X, wobbly slope <img src="13-regression-inference_files/figure-html/band-plot-1.png" alt="Two histograms of b across 5,000 samples of 30 students, on the same axis. With any baseline score, b stays in a narrow pile around 0.8, with an SD of 0.24. With baseline scores from 8 to 14, the pile is more than twice as wide, with an SD of 0.53." width="90%" style="display: block; margin: auto;" /> .box-inv-8.small[Same number of students. The only change is how far apart they are on X] .source[Data: Muralidharan, Singh, and Ganimian (2019). 5,000 samples of each, drawn with replacement.] ??? Topic 11 said a narrow range hides a correlation. Here's the same problem for a slope. Compare with the pile for n = 8 a few slides back: more students narrow the pile too. Both piles sit close to the same slope: 0.77 and 0.66. Study B draws from the 353 students between 8 and 14. Design lesson: if you get to choose your X values, spread them out. --- layout: false class: center middle section-title section-title-6 animated fadeIn # Testing the slope --- layout: true class: title title-6 --- # Steps 1 and 2: H₀ says the line is flat <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Step </th> <th style="text-align:left;"> In words </th> <th style="text-align:left;"> Our 8 students </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 1. State H₀ </td> <td style="text-align:left;"> Baseline predicts nothing about endline, in the population </td> <td style="text-align:left;"> H₀: β = 0<br>H₁: β ≠ 0 </td> </tr> <tr> <td style="text-align:left;"> 2. Set the criteria </td> <td style="text-align:left;"> Two tails, α = 0.05, and a t curve </td> <td style="text-align:left;"> df = n − 2 = 6<br>t(6) beyond ±2.447 </td> </tr> </tbody> </table> .box-6.small[We found b = 2.25. Would a slope that steep be surprising, if the true line were flat?] .source[Data: Muralidharan, Singh, and Ganimian (2019). Students 25 to 32.] ??? Back to our 8 students from Thursday. Two tails is our default. Why n − 2? The line spends two degrees of freedom, one on a and one on b. Topic 11 got the same df from the two means. H₀ doesn't have to be 0. It's almost always 0, because "no relationship" is the question people ask. --- # Under H₀, sample lines still tilt <div class="sim-slide" style="height: 495px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=7&n=8&d=0&a=2&view=stat&draws=551&seed=15" title="Simulator at step 7a with 551 samples of 8 pairs from a population with a flat line, Y = 2.00 + 0.00 X. Panel 2 shows one sample whose own line tilts anyway. Panel 3 shows t values stacked along a t curve with 6 degrees of freedom, with cutoffs near plus and minus 2.45." loading="lazy"></iframe> <img class="sim-static" src="img/sim/e63e750a72f6.png" alt="Simulator at step 7a with 551 samples of 8 pairs from a population with a flat line, Y = 2.00 + 0.00 X. Panel 2 shows one sample whose own line tilts anyway. Panel 3 shows t values stacked along a t curve with 6 degrees of freedom, with cutoffs near plus and minus 2.45."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? Here β = 0, the world H₀ describes. The population line is flat, yet panel 2's line still tilts. Panel 3 turns each b into a t. About 5% of them land beyond the cutoffs, which are the ±2.447 from step 2. **Press +1 a few times** and watch a dot land past a cutoff now and then. Each one is a Type 1 error. --- # Three things narrow the pile <div class="math-display">\[ \hat{\sigma}_b = \sqrt{\frac{MS_{residual}}{SS_X}} \qquad \text{where} \qquad MS_{residual} = \frac{SS_{residual}}{n - 2} \]</div> .pull-left-3[ .box-inv-6.small[Tight dots: small MS<sub>residual</sub>] ] .pull-middle-3[ .box-inv-6.small[Wide X: big SS<sub>X</sub>] ] .pull-right-3[ .box-inv-6.small[More students: big SS<sub>X</sub>] ] .box-6.small[It has the shape of σ̂<sub>M</sub> = σ̂ / √n: the scatter, over how much information we have] .book-tag[In the book: √MS<sub>residual</sub> is the standard error of estimate. Software calls σ̂<sub>b</sub> the "Std. Error"] ??? MS residual is the average squared miss from Thursday, with n − 2 on the bottom. It's our estimate of the variance around the line. Students don't need to derive this. They should be able to say why each of the three things helps. The first was the loose and tight dots on Thursday, and the second was the poll. --- # Step 3: The same fraction again <div class="math-display">\[ MS_{residual} = \frac{58.5}{6} = 9.75 \qquad\qquad \hat{\sigma}_b = \sqrt{\frac{9.75}{24}} = 0.637 \]</div> <div class="math-display">\[ t = \frac{b - \beta}{\hat{\sigma}_b} = \frac{2.25 - 0}{0.637} = 3.53 \]</div> .pull-left[ .box-inv-6.small[Top: how far b is from H₀'s β of 0] ] .pull-right[ .box-inv-6.small[Bottom: how far a b typically falls] ] .box-6.small[3.53 is beyond ±2.447, so we reject H₀: t(6) = 3.53, p = 0.012] .source[Data: Muralidharan, Singh, and Ganimian (2019). Students 25 to 32. SS<sub>residual</sub> is from Topic 12, SS<sub>X</sub> from Topic 11.] ??? SS residual = 58.5 is the "Least squares" total from Thursday's curve. SS<sub>X</sub> = 24 is from Topic 11. Decision wording as in Topic 7: this slope would be surprising if the true line were flat, so we reject H₀. --- # It's Topic 11's t, to the last decimal <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Our 8 students </th> <th style="text-align:left;"> Bottom of the fraction </th> <th style="text-align:left;"> t </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Topic 11: test r </td> <td style="text-align:left;"> σ̂<sub>r</sub> = √((1 − r²) / (n − 2)) = 0.233 </td> <td style="text-align:left;"> 0.822 / 0.233 = <strong>3.53</strong> </td> </tr> <tr> <td style="text-align:left;"> Today: test b </td> <td style="text-align:left;"> σ̂<sub>b</sub> = √(MS<sub>residual</sub> / SS<sub>X</sub>) = 0.637 </td> <td style="text-align:left;"> 2.25 / 0.637 = <strong>3.53</strong> </td> </tr> </tbody> </table> .box-inv-6.small.sp-after-half[b is r, rescaled into points. The same rescaling turns σ̂<sub>r</sub> into σ̂<sub>b</sub>, so the fraction doesn't change] .box-6.small[H₀: ρ = 0 and H₀: β = 0 are one question. If r is 0, b is 0] .source[Data: Muralidharan, Singh, and Ganimian (2019). Students 25 to 32.] ??? Topic 12 showed b = r × σ̂<sub>Y</sub> / σ̂<sub>X</sub>. Multiply the top and bottom of Topic 11's fraction by that same ratio, and you get today's fraction. In numbers, 0.233 × 2.739 = 0.637. The 2024 deck got 3.51 from r rounded to 0.82, and said the two routes differ by rounding. With three decimals in r, they agree. --- # Eight students or 539: reject H₀ <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> Step </th> <th style="text-align:left;"> Our 8 students </th> <th style="text-align:left;"> All 539 students </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 1. State H₀ </td> <td style="text-align:left;"> β = 0 </td> <td style="text-align:left;"> β = 0 </td> </tr> <tr> <td style="text-align:left;"> 2. Set the criteria </td> <td style="text-align:left;"> t(6) beyond ±2.447 </td> <td style="text-align:left;"> t(537) beyond ±1.964 </td> </tr> <tr> <td style="text-align:left;"> 3. Find the spread </td> <td style="text-align:left;"> σ̂<sub>b</sub> = √(9.75 / 24) = 0.637 </td> <td style="text-align:left;"> σ̂<sub>b</sub> = √(26.66 / 8,269) = 0.057 </td> </tr> <tr> <td style="text-align:left;"> 3. Compute t </td> <td style="text-align:left;"> b = 2.25, t = 3.53 </td> <td style="text-align:left;"> b = 0.76, t = 13.46 </td> </tr> <tr> <td style="text-align:left;"> 4. Decide </td> <td style="text-align:left;"> Reject H₀: 3.53 > 2.447 </td> <td style="text-align:left;"> Reject H₀: 13.46 > 1.964 </td> </tr> </tbody> </table> .box-inv-6.small.sp-after-half[Eight students: b = 2.25, t(6) = 3.53, p = 0.012, r² = 0.675] .box-6.small[All 539: Ŷ = 8.87 + 0.76X, t(537) = 13.46, p < 0.001, r² = 0.252] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? The right-hand column is the real test. With 539 students, σ̂<sub>b</sub> is about a tenth of what it was with 8, so t is much larger even though b is smaller. Our line matches 2024: 8.87 and 0.76. The numbers on the bottom of step 3 come from SS residual = 14,314 and df = 537. --- # An interval for β, the Topic 8 way <img src="13-regression-inference_files/figure-html/interval-plot-1.png" alt="Two horizontal 95 percent intervals for the slope, with a dashed vertical line at 0. For our 8 students, the interval runs from 0.69 to 3.81 around 2.25. For all 539 students, it runs from 0.65 to 0.88 around 0.76. Neither interval reaches 0." width="90%" style="display: block; margin: auto;" /> .pull-left[ .box-inv-6.small[8 students: 2.25 ± 2.447 × 0.637] ] .pull-right[ .box-inv-6.small[All 539: 0.76 ± 1.964 × 0.057] ] .box-6.small[Neither interval holds 0, so both tests reject. It's the rule from Topic 8] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? Same recipe as Topic 8: the t cutoff from step 2, times the standard error. Students could do this on a calculator. The interval says something a t alone doesn't: with all 539, a point at baseline goes with about 0.65 to 0.88 points at endline. The 95% is about the method, as in Topic 8, not about this one interval. The test also assumes things about the data, which is the next slide. --- # The test trusts four things .pull-left[ .box-inv-6.small.sp-after-half[**Straight:** a line, not a curve] .box-inv-6.small.sp-after-half[**Even spread:** as wide at every X] .box-inv-6.small.sp-after-half[**Independent:** one miss says nothing about another] .box-inv-6.small[**Normal misses:** a bell around 0. Matters less with many students] ] .pull-right[ <img src="13-regression-inference_files/figure-html/residual-plot-1.png" alt="Scatter plot of the misses from the line for all 539 students, against their baseline math score. The dots form an even band around a dashed line at 0, about as wide at low baseline scores as at high ones, with no curve. The misses run from about −18 to about 15 points." width="100%" style="display: block; margin: auto;" /> ] .box-6.small[Plot the misses first. Ours form an even band around 0, so the test is fair] .source[Data: Muralidharan, Singh, and Ganimian (2019). All 539 students, jittered so tied scores show.] ??? These are the assumptions behind the t, the interval and F for a slope. Students should be able to name them and say what breaking one looks like. They won't test them formally. What breaking each looks like: a curve, so the misses smile or frown. A fan, so the misses spread wider at one end. Students who share a center or a classroom, who may be more alike than strangers. A few huge misses, or a lopsided pile. Our data passes. A curve term adds nothing (p = 0.66). The misses have an SD of about 4 to 5.5 points in every band of baseline scores, and their pile is nearly symmetric. Independence is the one a plot can't show: it comes from how the students were sampled. The same four sit behind the two-sample t and ANOVA, where "even spread" was the equal-variance assumption behind pooling. --- # Real, big and causal are three questions <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Question </th> <th style="text-align:left;"> What answers it </th> <th style="text-align:left;"> All 539 students </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Is the slope real? </td> <td style="text-align:left;"> The test: t and p </td> <td style="text-align:left;"> Yes: t(537) = 13.46, p < 0.001 </td> </tr> <tr> <td style="text-align:left;"> How big is it? </td> <td style="text-align:left;"> b in points, and r² </td> <td style="text-align:left;"> 0.76 points per point, r² = 0.252 </td> </tr> <tr> <td style="text-align:left;"> Did X cause Y? </td> <td style="text-align:left;"> The design, not the test </td> <td style="text-align:left;"> We can't say: no lottery set baseline scores </td> </tr> </tbody> </table> .box-6.small[Rejecting H₀ says the line isn't flat, not that it's steep. With enough students, a tiny slope passes too] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? "Is the slope real?" has a modest answer. It says we don't think the true line is flat. Nobody doubted that baseline and endline math scores go together, so H₀ was a low bar here. The same point came up with effect sizes in Topic 8 and with correlation in Topic 11. Topic 14 uses a slope that a lottery set, where the third question gets a better answer. --- layout: false class: title title-8 # Try it: Nine fifth graders' slope .pull-left[ .box-inv-8.small[n = 9] .box-inv-8.small[b = 0.489] .box-inv-8.small[SS<sub>X</sub> = 412] .box-inv-8.small[SS<sub>residual</sub> = 191.2] ] .pull-right[ .box-8.small.sp-after-half[Test H₀: β = 0 with α = 0.05 and two tails. The cutoff is t(7) = ±2.365] .box-inv-8.small[Find MS<sub>residual</sub>, then σ̂<sub>b</sub>, then t. Then decide] ] .box-inv-8.small[First, predict: Topic 11 tested these students' r. What will t be today? Then work alone, compare with a neighbor, and vote with hands: reject or maintain?] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes, with calculators. Some students will remember that Topic 11's answer was t = 1.90. That's the point. Common slip: using n − 1 for MS residual, or forgetting the square root. --- class: title title-8 # Try it: Answer .pull-left-3[ .box-inv-8.small[MS<sub>residual</sub> = 191.2 / 7 = **27.31**] ] .pull-middle-3[ .box-inv-8.small[σ̂<sub>b</sub> = √(27.31 / 412) = **0.257**] ] .pull-right-3[ .box-inv-8.small[t = 0.489 / 0.257 = **1.90**] ] .box-8.small.sp-after-half[1.90 is inside ±2.365, so we **maintain H₀**: t(7) = 1.90, p = 0.099] .box-inv-8.small.sp-after-half[It's the same t as Topic 11, so it's the same decision] .box-inv-8.small[Maintaining H₀ doesn't mean the true line is flat. It means 9 students can't tell] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? These nine are a real group, not a random sample of fifth graders, so read this as practice with the steps. --- layout: false class: center middle section-title section-title-3 animated fadeIn # F, r² and R's output --- layout: true class: title title-3 --- # ANOVA's split works for a line .pull-left[ .tree-top.box-3.small[SS<sub>Y</sub> = 180.0] <div class="tree-arrows" aria-hidden="true"><span>↙</span><span>↘</span></div> .tree-row[ .box-inv-3.small[SS<sub>regression</sub><br>r²SS<sub>Y</sub> = 121.5] .box-inv-3.small[SS<sub>residual</sub><br>(1 − r²)SS<sub>Y</sub> = 58.5] ] ] .pull-right[ .tree-top.box-3.small[df<sub>Y</sub> = n − 1 = 7] <div class="tree-arrows" aria-hidden="true"><span>↙</span><span>↘</span></div> .tree-row[ .box-inv-3.small[df<sub>regression</sub><br>1] .box-inv-3.small[df<sub>residual</sub><br>n − 2 = 6] ] ] .box-3.small[Regression plays the part of between. Residual plays the part of within] .source[After Gravetter et al., *Essentials of Statistics for the Behavioral Sciences*, 10e. Data: Muralidharan et al. (2019).] ??? Thursday's bars split SS<sub>Y</sub> this way, with the same numbers. This is the "analysis of regression". What X predicts goes on top of F, and what's left over goes on the bottom. A line has one slope, so regression gets 1 df. r² is the only link between the two pieces: 0.675 × 180.0 = 121.5. --- # F agrees: 12.46 is beyond 5.99 <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> Source </th> <th style="text-align:center;"> SS </th> <th style="text-align:center;"> df </th> <th style="text-align:center;"> MS </th> <th style="text-align:center;"> F </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Regression </td> <td style="text-align:center;"> 121.50 </td> <td style="text-align:center;"> 1 </td> <td style="text-align:center;"> 121.50 </td> <td style="text-align:center;"> <strong>12.46</strong> </td> </tr> <tr> <td style="text-align:left;"> Residual </td> <td style="text-align:center;"> 58.50 </td> <td style="text-align:center;"> 6 </td> <td style="text-align:center;"> 9.75 </td> <td style="text-align:center;"> </td> </tr> <tr> <td style="text-align:left;"> Total </td> <td style="text-align:center;"> 180.00 </td> <td style="text-align:center;"> 7 </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> </tr> </tbody> </table> .pull-left[ .box-inv-3.small[H₀: β = 0. One cutoff: F(1, 6) = 5.99] ] .pull-right[ .box-inv-3.small[F = 121.50 / 9.75 = 12.46] ] .box-3.small[12.46 is beyond 5.99, so we reject H₀: F(1, 6) = 12.46, p = 0.012] .source[Data: Muralidharan, Singh, and Ganimian (2019). Students 25 to 32.] ??? Same table as ANOVA, read left to right: SS / df = MS, then the ratio. F looks in one tail only, because squares can't be negative. The 2024 deck got 12.315, from r rounded to 0.82. Exact SS gives 12.46. It also left a t criterion on this slide by mistake. An F-test has only the F cutoff. --- # One test, three ways <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:left;"> Formula </th> <th style="text-align:center;"> Our 8 </th> <th style="text-align:center;"> All 539 </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Test r </td> <td style="text-align:left;"> t = r / σ̂<sub>r</sub> </td> <td style="text-align:center;"> t(6) = 3.53 </td> <td style="text-align:center;"> t(537) = 13.46 </td> </tr> <tr> <td style="text-align:left;"> Test b </td> <td style="text-align:left;"> t = b / σ̂<sub>b</sub> </td> <td style="text-align:center;"> t(6) = 3.53 </td> <td style="text-align:center;"> t(537) = 13.46 </td> </tr> <tr> <td style="text-align:left;"> Test with F </td> <td style="text-align:left;"> F = MS<sub>regression</sub> / MS<sub>residual</sub> </td> <td style="text-align:center;"> F(1, 6) = 12.46 </td> <td style="text-align:center;"> F(1, 537) = 181.2 </td> </tr> <tr> <td style="text-align:left;"> Effect size </td> <td style="text-align:left;"> r² = SS<sub>regression</sub> / SS<sub>Y</sub> </td> <td style="text-align:center;"> 0.675 </td> <td style="text-align:center;"> 0.252 </td> </tr> </tbody> </table> .box-inv-3.small.sp-after-half[F = t²: 3.53² = 12.46, and the cutoffs match too: 2.447² = 5.99] .box-3.small[With one predictor, these are the same test, so they always agree] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? Topic 10 showed F = t² for two groups. It's the same fact, and the same reason: squaring folds t's two tails into F's one. 13.46² = 181.2, which is the 181.2 in the last column. When Topic 14 adds a second predictor, each slope gets its own t, and F tests them all together. Then they're no longer the same number. --- # R prints all of it at once <div class="r-output"><div>Call: </div><div>lm(formula = endline ~ baseline, data = mindspark) </div><div> </div><div>Residuals: </div><div> Min 1Q Median 3Q Max </div><div>-18.0384 -3.5099 -0.1523 3.8722 15.4901 </div><div> </div><div>Coefficients: </div><div> Estimate Std. Error t value Pr(>|t|) </div><div>(Intercept) 8.86764 0.66623 13.31 <2e-16 *** <span class="r-note">← a</span></div><div>baseline 0.76423 0.05678 13.46 <2e-16 *** <span class="r-note">← b, σ̂<sub>b</sub>, t, p</span></div><div>--- </div><div>Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 </div><div> </div><div>Residual standard error: 5.163 on 537 degrees of freedom <span class="r-note">← √MS<sub>residual</sub>, df</span></div><div>Multiple R-squared: 0.2523, Adjusted R-squared: 0.2509 <span class="r-note">← r²</span></div><div>F-statistic: 181.2 on 1 and 537 DF, p-value: < 2.2e-16 <span class="r-note">← F = t²</span></div></div> .source[Data: Muralidharan, Singh, and Ganimian (2019). Output from R, `summary(lm())`. You read this. You won't need to write it.] ??? This is the first place students read raw output, and Topic 14 does it again. They don't write R. In Lab 9, a spreadsheet's `SLOPE` and `INTERCEPT` gave the same line, and its `LINEST` gives the rest of these numbers. Read it top to bottom: the call names the outcome first, the Coefficients table has one row per number in the line, and the bottom three lines describe the whole fit. --- # Every number, in our words <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> R prints </th> <th style="text-align:left;"> We say </th> <th style="text-align:center;"> Here </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Estimate, both rows </td> <td style="text-align:left;"> a and b </td> <td style="text-align:center;"> 8.87 and 0.76 </td> </tr> <tr> <td style="text-align:left;"> Std. Error </td> <td style="text-align:left;"> σ̂<sub>b</sub> </td> <td style="text-align:center;"> 0.057 </td> </tr> <tr> <td style="text-align:left;"> t value </td> <td style="text-align:left;"> t = b / σ̂<sub>b</sub> </td> <td style="text-align:center;"> 13.46 </td> </tr> <tr> <td style="text-align:left;"> Pr(>|t|) </td> <td style="text-align:left;"> p, with two tails </td> <td style="text-align:center;"> Below 0.001 </td> </tr> <tr> <td style="text-align:left;"> Residual standard error </td> <td style="text-align:left;"> √MS<sub>residual</sub>, the typical miss </td> <td style="text-align:center;"> 5.16 points </td> </tr> <tr> <td style="text-align:left;"> degrees of freedom </td> <td style="text-align:left;"> n − 2 </td> <td style="text-align:center;"> 537 </td> </tr> <tr> <td style="text-align:left;"> Multiple R-squared </td> <td style="text-align:left;"> r² </td> <td style="text-align:center;"> 0.252 </td> </tr> <tr> <td style="text-align:left;"> F-statistic </td> <td style="text-align:left;"> F = t² </td> <td style="text-align:center;"> 181.2 </td> </tr> </tbody> </table> .box-3.small[<2e-16 is a decimal point, 15 zeros, then a 2. We report it as p < 0.001] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? What to ignore for now: the Residuals line at the top, Adjusted R-squared, and the intercept's t and p, which test whether the line crosses 0 at X = 0. Nobody asked that. The stars are a code for p. Scientific notation gets students stuck, so walk through it: 2e-16 means 2 × 10⁻¹⁶. --- # A paper shows the same numbers .pull-left[ <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> </th> <th style="text-align:center;"> Endline math </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Baseline math </td> <td style="text-align:center;"> 0.76***<br>(0.06) </td> </tr> <tr> <td style="text-align:left;"> Constant </td> <td style="text-align:center;"> 8.87***<br>(0.67) </td> </tr> <tr> <td style="text-align:left;"> Observations </td> <td style="text-align:center;"> 539 </td> </tr> <tr> <td style="text-align:left;"> R² </td> <td style="text-align:center;"> 0.25 </td> </tr> </tbody> </table> .table-note[Standard errors in parentheses. Three stars: p < 0.001] ] .pull-right[ .box-inv-3.small.sp-after-half[Each column is one regression, and it names the outcome] .box-inv-3.small.sp-after-half[The number in parentheses is usually σ̂<sub>b</sub>. Find t yourself: 0.76 / 0.06] .box-inv-3.small[Stars stand in for p. The constant is a] ] .source[Table made for this slide. Data: Muralidharan, Singh, and Ganimian (2019).] ??? Students will meet this format in EDUC 157 and 159, and in any education journal. Always read the table's note. Some journals put t or a p-value in the parentheses. Dividing the two rounded numbers gives about 12.7, close to the 13.46 that R shows. Rounded tables lose a little. --- layout: false class: title title-8 # Play it: Read the output <div class="r-output"><div>lm(formula = endline ~ ses_index, data = mindspark) </div><div> Estimate Std. Error t value Pr(>|t|) </div><div>(Intercept) 17.3651 0.2531 68.605 < 2e-16 *** </div><div>ses_index 0.6557 0.1534 4.275 2.26e-05 *** </div><div>Residual standard error: 5.872 on 537 degrees of freedom </div><div>Multiple R-squared: 0.03292, Adjusted R-squared: 0.03112 </div><div>F-statistic: 18.28 on 1 and 537 DF, p-value: 2.259e-05 </div></div> .clues[ .clue[ **100** The predicted endline score at an SES index of 0 ] .clue[ **200** This, divided by 0.153, gives 4.275 ] .clue[ **300** The share of endline variability that goes with SES ] .clue[ **400** Real? Big? Answer both with numbers from here ] ] .box-8.small[Answer with a neighbor, as a question. Nothing is scored] .source[Data: Muralidharan, Singh, and Ganimian (2019). The SES index is a score for each family.] ??? About 6 minutes. Read one clue at a time, in order. Take answers by hands or by calling out. Each student has a new predictor here, so it's the same output with new numbers. --- class: title title-8 # Play it: Answers .clues[ .clue[ **100: What is 17.37?**<br>It's a, the intercept ] .clue[ **200: What is b = 0.656?**<br>Estimate / Std. Error = t ] .clue[ **300: What is 3.3%?**<br>Multiple R-squared is 0.033 ] .clue[ **400: What is real, but small?**<br>t(537) = 4.275, p < 0.001, r² = 0.033 ] ] .box-8.small.sp-after-half[4.275² = 18.28, the F-statistic. One predictor, one test] .box-inv-8.small[Baseline math has r² = 0.252. SES has 0.033. Both slopes are real, and they aren't equally useful] .source[Data: Muralidharan, Singh, and Ganimian (2019).] --- class: title title-8 # The blueprint so far <table class="deck-table tight small-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;"> df </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;"> None </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;"> None </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;"> n − 1 </td> </tr> <tr> <td style="text-align:left;"> 3b. Mean gain </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> σ̂<sub>M</sub> of the gains </td> <td style="text-align:center;"> n − 1 </td> </tr> <tr> <td style="text-align:left;"> 4. Two means </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> σ̂<sub>M₁−M₂</sub> </td> <td style="text-align:center;"> n₁ + n₂ − 2 </td> </tr> <tr> <td style="text-align:left;"> 5. Two or more means </td> <td style="text-align:center;"> F </td> <td style="text-align:center;"> MS<sub>within</sub> </td> <td style="text-align:center;"> k − 1 and N − k </td> </tr> <tr> <td style="text-align:left;"> 6. A correlation </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> σ̂<sub>r</sub> </td> <td style="text-align:center;"> n − 2 </td> </tr> <tr> <td style="text-align:left;"> <strong>7a. A slope</strong> </td> <td style="text-align:center;"> <strong>t</strong> </td> <td style="text-align:center;"> <strong>σ̂<sub>b</sub></strong> </td> <td style="text-align:center;"> <strong>n − 2</strong> </td> </tr> <tr> <td style="text-align:left;"> 7b. A slope for a yes/no X: next </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> Topic 14 </td> <td style="text-align:center;"> </td> </tr> </tbody> </table> .box-8.small[Same idea every time: what we saw, over what chance alone would give] ??? Step 7b is the last one. When X is 0 or 1, the slope is the gap between two groups. Topic 14 picks that up, and it takes us back to step 4. --- class: title title-8 # What you can do now .box-inv-8.small[Explain the sampling distribution of b, and what narrows it] .box-inv-8.small[Test H₀: β = 0 with σ̂<sub>b</sub>, t and n − 2 degrees of freedom] .box-inv-8.small[Split SS and df, and run the same test with F] .box-inv-8.small[Say why the tests of r, b and F agree, and why F = t²] .box-inv-8.small[Name the four things the test assumes, and check them in a plot of the misses] .box-inv-8.small[Read a, b, σ̂<sub>b</sub>, t, p, r² and F from R's output or a table in a paper] --- class: title title-8 # Next steps .pull-left[ .box-1.small[Thursday, March 11: Topic 14] Regression: groups and interactions. Read section 13-1 ] .pull-right[ .box-6.small[Friday, March 12: Lab 10] Quiz: final review. Bring a calculator ] .box-3.small[Finals week, March 13 to 19: the final exam. Date to come] <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; } .here-row { align-items: center; display: flex; gap: 0.4em; justify-content: center; } .here-row p { margin: 0; } .here-row .anteater img { margin: 0; max-height: 72px; } .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; } .source a { color: #244a70; text-decoration: underline; } .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.small-table { font-size: 0.66em; } 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 split of SS and df, after the book's figure */ .tree-top { width: 62%; margin: 0 auto; } .tree-arrows { display: flex; justify-content: space-around; width: 70%; margin: 0 auto; font-size: 1.1em; line-height: 1.1; color: #47505a; } .tree-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5em; } /* R's output, with a note beside the lines that matter */ .r-output { margin: 0.2em 0 0.4em 0; padding: 0.4em 0.6em; border: 1px solid #c9d1d9; background-color: #f6f7f8; font-family: 'Source Code Pro', 'Lucida Console', Monaco, monospace; font-size: 0.48em; line-height: 1.3; } .r-output div { white-space: pre; } .r-note { margin-left: 0.6em; font-family: 'Fira Sans Condensed', sans-serif; font-size: 1.1em; line-height: 1; font-weight: bold; color: #a93e31; } .r-note sub { line-height: 0; } .table-note { font-size: 0.6em; color: #47505a; } /* Jeopardy clues */ .clues { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35em 1em; margin: 0.3em 0 0.6em 0; font-size: 0.65em; } .clue { background-color: #f3f3f3; border: 2px solid #cccccc; padding: 0.35em 0.6em; } .clue p { margin: 0; } /* The printed PDF keeps the question and drops the answer slide */ @media print { .remark-slide-container:has(.poll-answer) { display: none !important; } } </style>