Exercise 1: Sleep Hours vs. Bugs Introduced — Possible Solution ==================================================================== GIVEN ------------------------------ sleep = [7, 5, 8, 4, 6, 7] bugs = [1, 4, 0, 6, 3, 2] STEP 1: THE MEANS ------------------------------ sleep-bar = (7+5+8+4+6+7)/6 = 37/6 ~= 6.167 bugs-bar = (1+4+0+6+3+2)/6 = 16/6 ~= 2.667 STEP 2: COMPUTING r VIA THIS CHAPTER'S OWN FORMULA ------------------------------ Applying r = sum((x-xbar)(y-ybar)) / sqrt(sum((x-xbar)^2) x sum((y-ybar)^2)) to the sleep/bugs data (computed directly per this chapter's own worked-example method) gives: r ~= -0.985 STEP 3: INTERPRETING THE RESULT ------------------------------ A value of -0.985 is extremely close to -1, per this chapter's own scale (-1 = perfect negative linear relationship). This is a very STRONG NEGATIVE correlation: on days with more sleep, this developer introduced noticeably fewer bugs, in an almost perfectly linear pattern across these six days. WHY THIS WORKS AS AN ANSWER ------------------------------ The correlation coefficient is computed using this chapter's own Pearson's r formula, and the strength/direction interpretation is made by comparing the result against this chapter's own -1-to-+1 scale, correctly identifying it as strong and negative rather than simply reporting the raw number without context. (Note: per this chapter's own central caution, this correlation alone does not prove more sleep CAUSES fewer bugs - a confounder such as overall workload or stress level on a given day could plausibly drive both variables at once.)