Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Suppose e[i] and o[i] are arrays holding the expected and observed count of rolls for each of the 6 possibilities. In your case, e[i] is 100 for each bin, and o[i] is the number of times i was rolled in your 600 trials.</p> <p>You then calculate the chi-squared statistic by summing (e[i]-o[i])<sup>2</sup>/e[i] over the 6 bins. Lets say your o[i] array came out with 105, 95, 102, 98, 98, and 102 counts after doing your 600 trials.</p> <p>chi<sup>2</sup> = 5<sup>2</sup>/100 + 5<sup>2</sup>/100 + 2<sup>2</sup>/100 + 2<sup>2</sup>/100 + 2<sup>2</sup>/100 + 2<sup>2</sup>/100 = .660</p> <p>You have five degrees of freedom (number of bins minus 1). So you're going to have a declaration like</p> <pre><code>boost::math::chi_squared mydist(5); </code></pre> <p>to create the Boost object representing your chi-square distribution.</p> <p>At this point you would use the <code>cdf</code> accessor function (cumulative distribution function) from the Boost library to look up the p-value corresponding to a chi-squared score of .660 with five degrees of freedom. </p> <pre><code>p = boost::math::cdf(mydist,.660); </code></pre> <p>You should get something close to 0.015, which would be interpreted as a (1 - .015) = 98.5% probability of observing a chi-squared score at least as extreme as 0.660, if one assumes the null hypothesis (that the die is fair) holds. So for this set of data, the null hypothesis cannot be rejected with any reasonable confidence level. (Disclaimer: untested code! But if I understand the Boost documentation correctly, this is how it should work.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload