title: Matlab test of independence
body: <p>For 1,000,000 observations, I observed a discrete event, X, 3 times for the control group and 10 times for the test group. </p>
  
  <p>I need to preform a Chi square test of independence in Matlab. This is how you would do it in r:</p>
  
  <pre><code>m &lt;- rbind(c(3, 1000000-3), c(10, 1000000-10))
  #      [,1]   [,2] 
  # [1,]    3 999997
  # [2,]   10 999990
  chisq.test(m)
  </code></pre>
  
  <p>The r function returns chi-squared = 2.7692, df = 1, p-value = 0.0961.</p>
  
  <p>What Matlab function should I use or create to do this?</p>