Created
March 12, 2019 03:04
-
-
Save panicpotatoe/d3baa69f59f2bfba040a2abcbd1fb756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # STEP 3: CALCULATE THE CHI SQUARE VALUE and CRITICAL VALUE | |
| """ | |
| Chi square formula: | |
| chi square = total of [(observed - expected)^2]/expected | |
| Note: We call .sum() twice: once to get the column sums | |
| and a second time to add the column sums together, | |
| returning the sum of the entire 2D table. | |
| """ | |
| chi_squared_stat = (((observed-expected)**2)/expected).sum().sum() | |
| print(chi_squared_stat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment