class: center middle main-title section-title-4 # Correlation .class-info[ **Topic 11 · Tuesday, March 2** .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?] .center[**We are here**] .anteater[] ] .pull-right-3[ .box-3.medium[Explanation] ] .source[Peter the Anteater at a UC Irvine basketball game.] ??? Same map. Until now we've compared groups. Today each person has two scores, and we ask how the scores go together. It's the first step toward regression, which takes three sessions after this one. --- name: outline class: title title-8 # Plan for today .box-1.medium.sp-after-half[What r shows] .box-6.medium.sp-after-half[Computing r] .box-3.medium.sp-after-half[Testing r] ??? Three blocks of about 20 minutes. Each ends with students doing something: predict, try, try. The running question: does a student's baseline math score predict their endline score? --- layout: false class: center middle section-title section-title-1 animated fadeIn # What r shows --- layout: true class: title title-1 --- # Each dot is one student <img src="11-correlation_files/figure-html/scatter-plot-1.png" alt="Scatter plot of 539 Mindspark students, with baseline math score on the horizontal axis and endline math score on the vertical axis. The dots form a wide cloud that rises from lower left to upper right." width="86%" style="display: block; margin: auto;" /> .source[Data: Muralidharan, Singh, and Ganimian (2019). 539 students. Dots are nudged so equal scores don't hide each other.] ??? Our question from 2024: does a student's baseline score predict their endline score? Every student has two scores, so every student is one dot. Ask: what do you see? Students who start higher tend to end higher, but there's a lot of scatter. We aren't saying anything about what causes what yet. --- # A correlation describes three things <img src="11-correlation_files/figure-html/features-plot-1.png" alt="Six small scatter plots of made-up data in three columns. Direction: one cloud rises and one falls. Form: one cloud follows a straight line and one follows an arch. Consistency: one cloud hugs a line tightly and one is loose." width="88%" style="display: block; margin: auto;" /> .box-inv-1.small[Which way does it go? Is it straight? How closely do the dots follow it?] .source[Made-up data.] ??? Direction: when X goes up, does Y go up or down? Form: a straight line, or a curve? Consistency: how well does X tell you Y? Everyday pairs: years of education and income, or hours of cat videos and happiness. A correlation says nothing about what causes what. --- # r runs from −1 to 1 <img src="11-correlation_files/figure-html/gallery-plot-1.png" alt="Four scatter plots of made-up data. With r of minus 1, the dots lie on a falling line. With r of minus 0.4, a loose falling cloud. With r of 0, a round cloud with no direction. With r of 0.9, a tight rising cloud." width="92%" style="display: block; margin: auto;" /> .box-inv-1.small.sp-after-half[The sign gives the direction. The distance from 0 gives the consistency] .box-1.small[Our 539 students: r = 0.50. Upward, roughly straight, and loose] .source[Top: made-up data. Bottom: Muralidharan, Singh, and Ganimian (2019).] ??? This is Pearson's correlation. Pearson's r needs a straight-line form, which is the next slide. r has no units: it doesn't matter whether we use points, percent or z-scores. In the book, the sample value is also r. Greek ρ is the population value, and it comes in the third block. --- # Same r, four different stories <img src="11-correlation_files/figure-html/anscombe-plot-1.png" alt="Four scatter plots from Anscombe's quartet. All have a correlation of 0.82. The first is a loose straight cloud. The second is a smooth curve. The third is a tight line with one point far above it. The fourth is a stack of points at one X value, with one distant point that creates the correlation." width="92%" style="display: block; margin: auto;" /> .box-inv-1.small.sp-after-half[r measures straight lines only. The second panel is a perfect curve, and r can't tell] .box-1.small[Plot your data before you trust the number] .source[Data: Anscombe (1973), four made-up data sets.] ??? Each panel has 11 points, and all four have r = 0.82. Only the first one is what r = 0.82 makes you picture. Our 8 students later today happen to have the same r. Any r can hide any of these. --- # Don't forget to plot your data .box-1.small.sp-after-half[All of these data sets have the same means, SDs and correlation] <div class="datasaurus"> <img class="ds-still" src="img/datasaurus.png" alt="A scatter plot of points that form a dinosaur, next to its summary statistics: X mean 54.26, Y mean 47.83, X SD 16.76, Y SD 26.93, correlation −0.06."> <img class="ds-moving" src="img/datasaurus.gif" alt="Animation of a scatter plot. The points move from a dinosaur to a star, circles, lines and other shapes, while the means, SDs and correlation beside it stay the same." hidden> <button type="button" class="play-button" onclick="var d=this.parentNode,s=d.querySelector('.ds-still'),m=d.querySelector('.ds-moving'),p=m.hidden;m.hidden=!p;s.hidden=p;this.textContent=p?'Pause':'Play';" onkeydown="event.stopPropagation()" onkeypress="event.stopPropagation()">Play</button> </div> .source[Matejka and Fitzmaurice (2017), ["Same Stats, Different Graphs,"](https://www.research.autodesk.com/publications/same-stats-different-graphs/) CHI 2017. Datasaurus: Alberto Cairo.] ??? Press Play. It starts paused, so the printed PDF shows the dinosaur. --- # A narrow range hides a correlation <img src="11-correlation_files/figure-html/range-plot-1.png" alt="The scatter plot of all 539 students. A band marks baseline scores from 10 to 12, and its dots are dark, while the rest are pale. Across all students r is 0.50. Inside the band the dots show no direction, and r is 0.06." width="84%" style="display: block; margin: auto;" /> .box-inv-1.small[Same tests, 181 students. We can only speak for the range we observed] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? This replaces the book's figure from 2024, using our own data. The relationship didn't go away. We just looked where X barely varies. It happens whenever a study selects people on X. Among students admitted to a selective school, entrance scores predict grades less well than they do across all applicants. --- layout: false class: title title-8 poll-slide # Predict it: One point, far from the rest .poll-respond[Respond at **PollEv.com/adb**] .box-inv-8.small[ A scatter plot has 12 points and r = 0.60. We add one new point: far to the right, and near the bottom. What happens to r? ] .options[ .option[ **A** It goes up ] .option[ **B** It barely moves ] .option[ **C** It drops a lot ] .option[ **D** It becomes exactly 0 ] ] ??? About 6 minutes for this slide and the next four. Vote, turn to a neighbor, vote again, then watch it live. 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 # Predict it: Add the outlier <div class="sim-slide" style="height: 495px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=correlation&n=12&r=0.6&seed=2027" title="Simulator's correlation view with 12 draggable points that rise from lower left to upper right, a regression line, and a readout showing r of 0.60." loading="lazy"></iframe> <img class="sim-static" src="img/sim/5d42a0ab5406.png" alt="Simulator's correlation view with 12 draggable points that rise from lower left to upper right, a regression line, and a readout showing r of 0.60."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com. On your phone: [the simulator page](https://educ15.de-barros.com/resource/simulator-correlation.html).] ??? **Press Add outlier.** r falls from 0.60 to 0.33. **Now drag that point** around while students call out what r will do. Drag it toward the corner, then back into the cloud. Students can't drag on this screen. Those with a phone or laptop can open the simulator's Correlation and regression page on the course site, where every point can be dragged. Leave Residuals and Squared residuals off. They belong to Topic 12. The line is there to show the direction. --- class: title title-8 poll-answer # Predict it: Answer .options[ .option.wrong[ **A** It goes up ] .option.wrong[ **B** It barely moves ] .option.correct[ **C** It drops a lot ] .option.wrong[ **D** It becomes exactly 0 ] ] .box-inv-8.small.sp-after-half[ One new point took r from 0.60 to 0.33, nearly half ] .box-8.small[ Now, the same move with 200 points. Hands: does r fall by more, by less, or by the same? ] --- class: title title-8 # Predict it: Same move, 200 points <div class="sim-slide" style="height: 495px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&tab=correlation&n=200&r=0.6&seed=2027" title="Simulator's correlation view with 200 draggable points in a rising cloud, a regression line, and a readout showing r of 0.60." loading="lazy"></iframe> <img class="sim-static" src="img/sim/915b034a3cb2.png" alt="Simulator's correlation view with 200 draggable points in a rising cloud, a regression line, and a readout showing r of 0.60."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? **Press Add outlier.** r only falls from 0.60 to 0.54. Drag it around. One point now has much less pull, because it's one of 201. --- layout: true class: title title-1 --- # One outlier swings 8 students, not 539 <img src="11-correlation_files/figure-html/ghost-plot-1.png" alt="Two scatter plots of baseline against endline math scores, each with one made-up student added at a baseline of 26 and an endline of 5. With 8 real students, r falls from 0.82 to −0.57. With all 539 students, r falls only from 0.50 to 0.48." width="92%" style="display: block; margin: auto;" /> .box-inv-1.small[The same made-up student flips the sign for 8 students, and barely touches the 539. Outliers matter less as n grows] .source[One made-up student added. Other data: Muralidharan, Singh, and Ganimian (2019).] ??? The same lesson as the simulator, on our own students. Only the diamond is invented. An outlier isn't a reason to delete a student. It's a reason to look, and to report what happens with and without them. --- # So what is a correlation good for? .pull-left[ .box-inv-1.small[Prediction] Baseline scores can flag who may need help, whatever the reason .box-inv-1.small[Reliability] The same test, given twice, should give similar scores ] .pull-right[ .box-inv-1.small[Validity] A new math test should correlate with an established one .box-inv-1.small[Testing theories] A theory says two things go together. Do they? ] ??? The first three are everyday uses in education research, and none of them needs a causal story. The fourth is where people get into trouble, which we come back to later today. --- layout: false class: center middle section-title section-title-6 animated fadeIn # Computing r --- layout: true class: title title-6 --- # Eight students, by hand .pull-left[ <table class="deck-table tight"> <thead> <tr> <th style="text-align:center;"> Baseline X </th> <th style="text-align:center;"> Endline Y </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 13 </td> <td style="text-align:center;"> 30 </td> </tr> <tr> <td style="text-align:center;"> 11 </td> <td style="text-align:center;"> 20 </td> </tr> <tr> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 16 </td> </tr> <tr> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 26 </td> </tr> <tr> <td style="text-align:center;"> 12 </td> <td style="text-align:center;"> 27 </td> </tr> <tr> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 16 </td> </tr> <tr> <td style="text-align:center;"> 12 </td> <td style="text-align:center;"> 22 </td> </tr> <tr> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 23 </td> </tr> </tbody> </table> ] .pull-right[ <img src="11-correlation_files/figure-html/eight-plot-1.png" alt="Scatter plot of the eight students, with baseline scores from 8 to 13 and endline scores from 16 to 30. The dots rise from lower left to upper right. Two students share the point at 8 and 16." width="100%" style="display: block; margin: auto;" /> ] .source[Data: Muralidharan, Singh, and Ganimian (2019). Students 25 to 32.] ??? The 2024 hand example. These are the 25th to 32nd of the students with both scores. There's nothing special about them, and we'll see that their r isn't the same as everyone's. Lab 9 on March 5 does this with `CORREL` on all 539. --- # Do the two scores move together? <img src="11-correlation_files/figure-html/quadrant-plot-1.png" alt="The eight students' scatter plot, with a dashed vertical line at the mean baseline score of 10.5 and a dashed horizontal line at the mean endline score of 22.5. The upper right and lower left corners are shaded and marked plus. The upper left and lower right are marked minus. The students farthest from the means are in the shaded corners." width="80%" style="display: block; margin: auto;" /> .box-inv-6.small[Multiply each student's two deviations. Same side of both means gives a positive product] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? This is a new idea with an old tool. For variance, we squared one deviation. Now we multiply two different deviations. If high goes with high and low goes with low, the products are mostly positive, and they add up to something big. The dashed lines are M<sub>X</sub> = 10.5 and M<sub>Y</sub> = 22.5. --- # The sum of products, SP <table class="deck-table tight"> <thead> <tr> <th style="text-align:center;"> X </th> <th style="text-align:center;"> Y </th> <th style="text-align:center;"> X − M<sub>X</sub> </th> <th style="text-align:center;"> Y − M<sub>Y</sub> </th> <th style="text-align:center;"> Product </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 13 </td> <td style="text-align:center;"> 30 </td> <td style="text-align:center;"> 2.5 </td> <td style="text-align:center;"> 7.5 </td> <td style="text-align:center;"> 18.75 </td> </tr> <tr> <td style="text-align:center;"> 11 </td> <td style="text-align:center;"> 20 </td> <td style="text-align:center;"> 0.5 </td> <td style="text-align:center;"> −2.5 </td> <td style="text-align:center;"> −1.25 </td> </tr> <tr> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 16 </td> <td style="text-align:center;"> −2.5 </td> <td style="text-align:center;"> −6.5 </td> <td style="text-align:center;"> 16.25 </td> </tr> <tr> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 26 </td> <td style="text-align:center;"> −0.5 </td> <td style="text-align:center;"> 3.5 </td> <td style="text-align:center;"> −1.75 </td> </tr> <tr> <td style="text-align:center;"> 12 </td> <td style="text-align:center;"> 27 </td> <td style="text-align:center;"> 1.5 </td> <td style="text-align:center;"> 4.5 </td> <td style="text-align:center;"> 6.75 </td> </tr> <tr> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 16 </td> <td style="text-align:center;"> −2.5 </td> <td style="text-align:center;"> −6.5 </td> <td style="text-align:center;"> 16.25 </td> </tr> <tr> <td style="text-align:center;"> 12 </td> <td style="text-align:center;"> 22 </td> <td style="text-align:center;"> 1.5 </td> <td style="text-align:center;"> −0.5 </td> <td style="text-align:center;"> −0.75 </td> </tr> <tr> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 23 </td> <td style="text-align:center;"> −0.5 </td> <td style="text-align:center;"> 0.5 </td> <td style="text-align:center;"> −0.25 </td> </tr> <tr> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> </td> <td style="text-align:center;"> <strong>SP</strong> </td> <td style="text-align:center;"> <strong>54.00</strong> </td> </tr> </tbody> </table> .book-tag[Shortcut: SP = ΣXY − (ΣX)(ΣY) / n = 1,944 − (84 × 180) / 8 = 54] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? SP is to two variables what SS is to one. SS is the sum of a deviation times itself. SP is the sum of one deviation times the other. Unlike SS, SP can be negative. M<sub>X</sub> = 10.5, M<sub>Y</sub> = 22.5. The shortcut needs no deviations, like the faster formula for SS. Both formulas give 54, so students can use either one. --- # r divides by each score's own spread <div class="math-display">\[ r = \frac{SP}{\sqrt{SS_X \, SS_Y}} \]</div> .pull-left[ .box-inv-6.small[Top: how much X and Y move together] ] .pull-right[ .box-inv-6.small[Bottom: how much each moves alone] ] <div class="math-display">\[ r = \frac{54}{\sqrt{24 \times 180}} = \frac{54}{65.73} = 0.822 \]</div> .box-6.small[The bottom is why r has no units, and why it stays between −1 and 1] ??? SS<sub>X</sub> = 24 and SS<sub>Y</sub> = 180, computed the usual way from the deviations on the last slide. SP alone depends on the scale: score the tests out of 100, and SP grows. Dividing by the spreads removes that. r can only reach 1 when X and Y move together as much as they move at all. --- # r² is the share we can predict <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Group </th> <th style="text-align:center;"> r </th> <th style="text-align:center;"> r² </th> <th style="text-align:left;"> In words </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Our 8 students </td> <td style="text-align:center;"> 0.822 </td> <td style="text-align:center;"> 0.675 </td> <td style="text-align:left;"> 67.5% of Y's variability can be predicted from X </td> </tr> <tr> <td style="text-align:left;"> All 539 students </td> <td style="text-align:center;"> 0.502 </td> <td style="text-align:center;"> 0.252 </td> <td style="text-align:left;"> 25.2% of Y's variability can be predicted from X </td> </tr> </tbody> </table> .box-inv-6.small.sp-after-half[r = 0.50 doesn't mean half. It means about a quarter of the variability is shared] .box-6.small[r² works like η̂² in ANOVA: a share of the total. It's our effect size] .book-tag[In the book: r² is the coefficient of determination] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? Say "predicted", not "caused". The share belongs to both variables, which is why it's called shared variability. It works in either direction: X predicts Y exactly as well as Y predicts X. Topic 12 shows where this share comes from, using the distance between each dot and a line. --- layout: false class: title title-8 # Try it: Five more students .pull-left[ <table class="deck-table tight"> <thead> <tr> <th style="text-align:center;"> Baseline X </th> <th style="text-align:center;"> Endline Y </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 13 </td> <td style="text-align:center;"> 14 </td> </tr> <tr> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 21 </td> </tr> <tr> <td style="text-align:center;"> 11 </td> <td style="text-align:center;"> 24 </td> </tr> <tr> <td style="text-align:center;"> 11 </td> <td style="text-align:center;"> 14 </td> </tr> <tr> <td style="text-align:center;"> 10 </td> <td style="text-align:center;"> 22 </td> </tr> </tbody> </table> ] .pull-right[ .box-inv-8.small[M<sub>X</sub> = 11, M<sub>Y</sub> = 19] .box-inv-8.small[SS<sub>X</sub> = 6, SS<sub>Y</sub> = 88] .box-8.small[Find SP, then r] ] .box-inv-8.small[Work alone, compare with a neighbor, then vote with hands: is r positive or negative?] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes, with calculators. Two of the X deviations are 0, so this is quicker than it looks. SS is given to save time. I picked these five because the arithmetic is easy and the sign is a surprise. That's fine to say out loud. --- class: title title-8 # Try it: Answer .pull-left[ <table class="deck-table tight"> <thead> <tr> <th style="text-align:center;"> X − M<sub>X</sub> </th> <th style="text-align:center;"> Y − M<sub>Y</sub> </th> <th style="text-align:center;"> Product </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> −5 </td> <td style="text-align:center;"> −10 </td> </tr> <tr> <td style="text-align:center;"> −1 </td> <td style="text-align:center;"> 2 </td> <td style="text-align:center;"> −2 </td> </tr> <tr> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> 5 </td> <td style="text-align:center;"> 0 </td> </tr> <tr> <td style="text-align:center;"> 0 </td> <td style="text-align:center;"> −5 </td> <td style="text-align:center;"> 0 </td> </tr> <tr> <td style="text-align:center;"> −1 </td> <td style="text-align:center;"> 3 </td> <td style="text-align:center;"> −3 </td> </tr> </tbody> </table> ] .pull-right[ .box-inv-8.small[SP = **−15**] .box-inv-8.small[r = −15 / √(6 × 88) = **−0.65**] ] .box-8.small[Eight students said 0.82, and these five say −0.65. All 539 say 0.50. Who's right?] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? A real group of five really does run the other way. Nothing went wrong. The question on this slide starts the next block. --- layout: false class: center middle section-title section-title-3 animated fadeIn # Testing r --- layout: true class: title title-3 --- # Three samples, three values of r <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Students </th> <th style="text-align:center;"> n </th> <th style="text-align:center;"> r </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Students 25 to 32 </td> <td style="text-align:center;"> 8 </td> <td style="text-align:center;"> 0.82 </td> </tr> <tr> <td style="text-align:left;"> The five from the try-it </td> <td style="text-align:center;"> 5 </td> <td style="text-align:center;"> −0.65 </td> </tr> <tr> <td style="text-align:left;"> Everyone with both scores </td> <td style="text-align:center;"> 539 </td> <td style="text-align:center;"> 0.50 </td> </tr> </tbody> </table> .box-3.small.sp-after-half[Each r estimates one number: ρ, the correlation in the population] .box-inv-3.small[Greek means population. r is to ρ what M is to μ] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? ρ is the Greek letter rho. r is a statistic, so it has a sampling distribution, like M did. That's step 6 of the blueprint. Each dot in panel 1 is now a person in the population, with an X and a Y. --- # With 8 students, r bounces a lot <div class="sim-slide" style="height: 495px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=6&n=8&d=0.5&view=raw&draws=2000&seed=15" title="Simulator at step 6 with 2,000 samples of eight pairs from a population with a true correlation of 0.5. Panel 1 shows a rising cloud. Panel 2 shows one sample's eight dots. Panel 3 shows the values of r piled up widely, from below 0 to near 1." loading="lazy"></iframe> <img class="sim-static" src="img/sim/b3cbacbf5577.png" alt="Simulator at step 6 with 2,000 samples of eight pairs from a population with a true correlation of 0.5. Panel 1 shows a rising cloud. Panel 2 shows one sample's eight dots. Panel 3 shows the values of r piled up widely, from below 0 to near 1."> </div> .source[Simulator after Kristoffer Magnusson, rpsychologist.com.] ??? Here ρ = 0.50, close to our 539 students. Samples of 8 give almost any r. Drag n up to see the pile narrow. On real data: treat our 539 students as the population. In 20,000 samples of 8, the middle 95% of r runs from −0.27 to 0.90, and 10% of samples reach 0.82 or more. So 0.82 from 8 students is ordinary. --- # Steps 1 and 2: H₀ says ρ = 0 <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;"> No relationship 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-3.small[The rule stays the same: is what we saw surprising, if nothing is going on?] ??? Same four steps as every test this quarter, with two tails as our default. Why n − 2? A correlation needs both means, M<sub>X</sub> and M<sub>Y</sub>, and each one costs a degree of freedom. --- # Under H₀, r still bounces <div class="sim-slide" style="height: 495px;"> <iframe class="sim-live" src="../simulator/index.html?ui=slide&step=6&n=8&d=0&view=stat&draws=551&seed=15" title="Simulator at step 6 with 551 samples of eight pairs from a population with a true correlation of 0. 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/8f94bbb7c6ef.png" alt="Simulator at step 6 with 551 samples of eight pairs from a population with a true correlation of 0. 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 round cloud in panel 1 has no relationship, but small samples still show one by chance. Panel 3 turns each r into a t. About 5% of them land beyond the cutoffs, which are the ±2.447 from step 2. --- # Step 3: The same fraction again <div class="math-display">\[ t = \frac{r - \rho}{\hat{\sigma}_r} \qquad \text{where} \qquad \hat{\sigma}_r = \sqrt{\frac{1 - r^2}{n - 2}} \]</div> .pull-left[ .box-inv-3.small[Top: how far r is from H₀'s ρ, which is 0] ] .pull-right[ .box-inv-3.small[Bottom: how far an r typically falls] ] .box-3.small[Ours: σ̂<sub>r</sub> = √(0.325 / 6) = 0.233, so t = 0.822 / 0.233 = **3.53**] .book-tag[In the book: σ̂<sub>r</sub> is written s<sub>r</sub>] ??? What we saw, over what chance alone would give: it's the same fraction as every t so far. The bottom shrinks with n. It also shrinks as r grows, because a tight cloud pins r down. The 2024 deck showed 3.51, because it rounded r to 0.82 first. With r² = 0.675, it's 3.53. Keep three decimals in r when computing. --- # 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>r</sub> = 0.233 </td> <td style="text-align:left;"> σ̂<sub>r</sub> = 0.037 </td> </tr> <tr> <td style="text-align:left;"> 3. Compute t </td> <td style="text-align:left;"> t = 3.53 </td> <td style="text-align:left;"> 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-3.small.sp-after-half[Eight students: t(6) = 3.53, p = 0.012, r = 0.82] .box-3.small[All 539: t(537) = 13.46, p < 0.001, r = 0.50, 95% CI [0.44, 0.56]] .source[Data: Muralidharan, Singh, and Ganimian (2019). Software gives the interval for r.] ??? Rejecting H₀ means this sample would be surprising if ρ were 0. It doesn't say the relationship is strong. r and r² do that. The 8 students overstate the relationship, and the 539 pin it down. The interval for r has its own formula, which is beyond this course, so we read it from software. Every t-test since Topic 8 comes with an effect size and an interval, and this one does too. --- # A correlation can't name a cause <table class="deck-table"> <thead> <tr> <th style="text-align:left;"> Pair </th> <th style="text-align:center;"> r </th> <th style="text-align:center;"> t </th> <th style="text-align:center;"> Who set X? </th> <th style="text-align:center;"> A cause? </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Tuition, baseline math </td> <td style="text-align:center;"> 0.10 </td> <td style="text-align:center;"> t(617) = 2.43 </td> <td style="text-align:center;"> Families </td> <td style="text-align:center;"> We can't say </td> </tr> <tr> <td style="text-align:left;"> Lottery, endline math </td> <td style="text-align:center;"> 0.23 </td> <td style="text-align:center;"> t(537) = 5.37 </td> <td style="text-align:center;"> A lottery </td> <td style="text-align:center;"> Yes </td> </tr> </tbody> </table> .box-inv-3.small.sp-after-half[Both correlations are significant. Math scores might drive tuition, or a third thing might drive both] .box-3.small[The lottery is the difference. It broke every other link, so only the program is left] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? Tuition: X is 1 if the family pays for any extra lessons. Stronger students may be the ones whose families pay. Or families may pay because a child is struggling. Or keen parents may do both things. The data can't tell these apart. The lottery: X is 1 for a Mindspark spot, and nobody could choose it. Before the program, the same lottery had no detectable link to math: r = −0.05, t(537) = −1.17. Watch for the trick of hinting at a cause in the discussion section, then retreating to "it's only a correlation" when someone objects. This is the "motte and bailey" from 2024. --- # Other kinds of scores, same formula <table class="deck-table tight"> <thead> <tr> <th style="text-align:left;"> The two variables </th> <th style="text-align:left;"> Name </th> <th style="text-align:left;"> What it does </th> <th style="text-align:left;"> Mindspark </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Both continuous </td> <td style="text-align:left;"> Pearson's r </td> <td style="text-align:left;"> What we did today </td> <td style="text-align:left;"> Baseline, endline: 0.50 </td> </tr> <tr> <td style="text-align:left;"> One or both ordinal </td> <td style="text-align:left;"> Spearman's r<sub>S</sub> </td> <td style="text-align:left;"> Pearson's r on ranks </td> <td style="text-align:left;"> Same scores, ranked: 0.48 </td> </tr> <tr> <td style="text-align:left;"> One binary, one continuous </td> <td style="text-align:left;"> Point-biserial r </td> <td style="text-align:left;"> Pearson's r, with 0 and 1 </td> <td style="text-align:left;"> Lottery, endline: 0.23 </td> </tr> <tr> <td style="text-align:left;"> Both binary </td> <td style="text-align:left;"> Phi, φ </td> <td style="text-align:left;"> Pearson's r, with 0 and 1 for both </td> <td style="text-align:left;"> Lottery, top half at endline: 0.19 </td> </tr> </tbody> </table> .box-3.small[The lottery's t(537) = 5.37 is Topic 9's two-sample t-test. Same data, same t] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? All three are Pearson's formula, applied to recoded numbers. Point-biserial r is why a t-test and a correlation agree, and it's the first hint that regression can do what t-tests do. Topic 14 comes back to it. φ breaks our rule: it's a Greek letter for an estimate. That's history, not a parameter. --- layout: false class: title title-8 # Try it: Nine fifth graders .box-inv-8.small.sp-after-half[Nine students started in grade 5. Their baseline and endline scores have r = 0.583] .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.sp-after-half[Find σ̂<sub>r</sub> and t, then decide. Work alone, compare with a neighbor, then vote with hands] .box-inv-8.small[This r is bigger than the 0.50 from all 539. Does that make it easier to reject?] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? About 6 minutes, with calculators. Vote on the decision: reject or maintain. Common slips: using n − 1 for df, or forgetting the square root. --- class: title title-8 # Try it: Answer .pull-left[ .box-inv-8.small[σ̂<sub>r</sub> = √((1 − 0.340) / 7) = **0.307**] ] .pull-right[ .box-inv-8.small[t = 0.583 / 0.307 = **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[A bigger r than everyone's, and still no rejection. With n = 9, an r this size isn't surprising if ρ = 0] .box-inv-8.small[Maintaining H₀ doesn't mean ρ = 0. It means 9 students can't tell] .source[Data: Muralidharan, Singh, and Ganimian (2019).] ??? A significance test weighs r against n. These nine are a real group, not a random sample of fifth graders, so read this as practice with the steps. --- class: title title-8 # The blueprint so far <table class="deck-table tight"> <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;"> <strong>6. A correlation</strong> </td> <td style="text-align:center;"> <strong>t</strong> </td> <td style="text-align:center;"> <strong>σ̂<sub>r</sub></strong> </td> <td style="text-align:center;"> <strong>n − 2</strong> </td> </tr> <tr> <td style="text-align:left;"> 7a. A slope: next </td> <td style="text-align:center;"> t </td> <td style="text-align:center;"> Topic 13 </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] ??? Steps 6 and 7 turn to relationships between two variables. In step 6, each dot in the population is a person with two scores. On Thursday, a line goes through those dots. --- class: title title-8 # What you can do now .box-inv-8.small[Read direction, form and consistency from a scatter plot] .box-inv-8.small[Say what outliers, curves and a narrow range do to r] .box-inv-8.small[Compute SP, r and r² by hand] .box-inv-8.small[Test H₀: ρ = 0 with t and n − 2 degrees of freedom] .box-inv-8.small[Explain why a correlation alone doesn't show a cause] --- class: title title-8 # Next steps .pull-left[ .box-1.small[Thursday, March 4: Topic 12] Regression: the line. Read the first part of section 14-6 ] .pull-right[ .box-6.small[Friday, March 5: Lab 9] Correlation and regression. Bring a calculator and a laptop ] .box-3.small[Mastery and Problem Set for Chapter 14 are due Sunday, March 7 at 6 PM] <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; } .source a { color: inherit; text-decoration: underline; } .anteater img { display: block; margin: 0.15em auto 0; max-height: 105px; } .datasaurus { text-align: center; } .datasaurus img { display: block; margin: 0 auto; max-width: 100%; max-height: 345px; } .datasaurus img[hidden] { display: none; } .play-button { background-color: #b18323; border: 0; color: white; cursor: pointer; font-family: inherit; font-size: 0.6em; margin-top: 0.3em; padding: 0.15em 0.9em; } .play-button:focus { outline: 3px solid #1f2933; outline-offset: 2px; } @media print { .play-button { display: none; } } /* 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 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 */ @media print { .remark-slide-container:has(.poll-answer) { display: none !important; } } </style>