Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created March 18, 2020 18:26
Show Gist options
  • Save NyaGarcia/2201b14464e7af9f52943f2246d9cf8c to your computer and use it in GitHub Desktop.
Save NyaGarcia/2201b14464e7af9f52943f2246d9cf8c to your computer and use it in GitHub Desktop.
Performing the pearson chi-square test for independence between gears and cylinders with Monte Carlo simulation
> chisq.test(mtcars$gear, mtcars$cyl, simulate.p.value = TRUE)
Pearson's Chi-squared test with simulated p-value (based on 2000
replicates)
data: mtcars$gear and mtcars$cyl
X-squared = 18.036, df = NA, p-value = 0.0004998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment