title: Run a chi square test with observation and expectation counts and get confidence interval
body: <p>I am new to chi squared testing and trying to figure out what the 'standard' way of running a chi-squared test and also getting a 95% confidence interval on the difference between success rates in two experiments.</p>
  
  <p>My data looks like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>Condition A:    25           75           100
  Condition B:    100          100          200
  Total:          125          175
  </code></pre>
  
  <p>These numbers represent the counts of what was observed during an experiment. As you can see, the number of samples for Condition A vs. Condition B were not the same.</p>
  
  <p>What I'd like to get is:</p>
  
  <ol>
  <li>A test statistic indicating whether Condition A's success rate of 33% is statistically different from Condition B's success rate of 50%.</li>
  <li>I'd also like to get a 95% confidence interval on the difference between the two success rates.</li>
  </ol>
  
  <p>It seems like <code>scipy.stats.chisquare</code> expects the user to adjust the 'expected' counts so that they appear to be taken out of the same sample size as the 'observed' counts. Is that the only transformation I need to do? If not, what else do I need to do? Finally, how would I go about calculating the 95% confidence interval for the difference in proportions?</p>