• admiralteal@kbin.social
    link
    fedilink
    arrow-up
    1
    ·
    6 months ago

    Gotta account for a null hypothesis.

    The null would be that it is a fair die (average roll 10.5). Your test is whether the true result is significantly less than 10.5 based on a sample of 100 with a mu of 8.8. Let’s call it an alpha of 0.05

    So we have to run a left tail one-sample t-test.

    Unfortunately, this data set doesn’t tell me the standard deviation – but that could be determined in future trials. For now, we’ll have to just make an assumption that the D20 is fair. For a fair D20, the standard deviation should be be sqrt( ([20-1+1]^2 -1)/12) or roughly sqrt(33.25)

    We can run that t-test in a simply python script:

    import numpy as np
    from scipy import stats as st
    
    h0 = 10.5
    
    sample = np.random.normal(loc=8.88, scale=(np.sqrt(33.25)), size=100)
    
    t_stat, p_val = st.ttest_1samp(sample, h0)
    
    print(f"T-statistic: {t_stat:.4f}")
    print(f"P-value: {p_val:.4f}")
    
    

    Of course, I had to randomize this a bit since I don’t have access to the full data from the true sample. That would make for a better bit of analysis. But at least assuming I didn’t make a serious dumb here, 100 rolls averaging 8.88 would seem to suggest that the you can reject your null hypothesis of this being a fair die at a typical alpha of 0.05.

    Then again, the way I wrote this script is GUARANTEED to be an unfavorable result since the way I randomized it REQUIRES the average end up 8.88, which is, of course, less than 10.5. Your real world testing would not have this constraint.

  • apotheotic (she/her)@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    100 rolls is a staggeringly small sample size for a set with 20 possible outcomes, I would take this with a grain of salt (or a lot of salt in a glass of water? ;) )

    In any case it’s fun to do some experimenting like this, thanks for sharing!