Back to Challenge Set 23

Code Challenge: Correlation Check

Difficulty  

Extra CreditOptional. It earns extra credit and does not count toward the five.

divider

The Brief

What they asked for
Streaming went up every year and CD sales went down every year.
Somebody wants to put "streaming killed the CD" in a
presentation. Check the data and tell them whether they can
say that.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • Write a method that steps through the years and counts how often streams and CD sales move the same way, and how often they move opposite ways. Use these numbers, in millions: years 2019 to 2023, streams 41, 55, 68, 79, 90, CDs 29, 22, 17, 13, 10.
  • The answer is a perfect opposite in every year. Do not stop there. The deliverable is a written verdict, not a number: what the data supports, what it does not, and what you would need to collect to settle it.
  • This one is more dangerous than Activity 2.18's gamers, because the obvious explanation might even be right. Say why that makes it harder, not easier.
  • Name at least one other thing that changed over the same years and could be driving both.

Sample Output

Sample Output
streams and CDs moved the same way in 0 of 4 changes
streams and CDs moved opposite ways in 4 of 4

Four out of four, and still not proof. A correlation found in data does not necessarily mean one thing caused the other, even when the story sounds obviously true.


Submit

Your requirements list and your program file, named cc-correlation-check.

Commence Challenge