Keren - 7 months ago 60

Javascript Question

Currently I'm reading **Eloquent Javascript** book and at **chapter 4**. This topic entitled '**The lycanthrope’s log** ' is very confusing to me. How important is **correlation and coefficient** in real world programming?

I'm trying to understand the formula used to find correlation. I've far forgotten maths since I left my high school. Could, someone who've read this book, **explain to me in detail**, please? Below is the picture I'm wondering about..

Answer

The formula is actually pretty straight forward. Consider the table from your question.

The table states that there were a total

90 observations

Out of all 90 observations:

**76 times**, no pizzas or squirrel**9 times**, pizzas but no squirrel**4 times**, squirrel but no pizzas**1 time**, both squirrel and pizza

So we want to find out how

Pizzas&Squirrelsare related:

Consider the equation along with your table now,

(since squirrel is on the left)

*Now that we know what these values are, let's plug them in to our formula* -

```
correlation = (1×76 - 4×9) / √(5×85×10×80)
```

Source (Stackoverflow)