void page8() { background(255); generateGraph(); image(pg, 180, 20); String t = "Exploring hypothesis testing"; textFont(myboldfont, 18); text(t, 30, 44); textFont(myfont, 18); if ((aStudy.known == 1) || (aStudy.samplesize>30)) { t = "N(0,1)"; text(t, 408, 60); } else { t = "t" + nf(aStudy.samplesize-1, 1); if(aStudy.samplesize == 10) { text(t, 423, 60); } else { text(t, 418, 60); } } if ((aStudy.known == 1) || (aStudy.samplesize>30)) { t = "The test statistic, z*, equals " + nf(testvalue, 1, 4) + " and the area to the left of z* (left-tailed value) is " + nf(zvalue, 1, 4)+"."; } else { t = "The test statistic, t*, equals " + nf(testvalue, 1, 4) + " and the area to the left of t* (left-tailed value) is " + nf(zvalue, 1, 4)+"."; } drawStrings(t, 80, 250, 25); t = "Null Hypothesis:"; textFont(myfont, 18); text(t, 80, 310); image(hyp0, 220, 295); t = "Alternative Hypothesis:"; text(t, 80, 345); if (rel == 0) { image(hyp1, 270, 331); t = "(right-tailed)"; } else if (rel == 1) { image(hyp2, 270, 331); t = "(left-tailed)"; } else { image(hyp3, 270, 331); t = "(two-tailed)"; } text(t, 400, 345); if (rel == 0) { t = "Thus, the p-value equals the total probability, which is 1, minus the left-tailed value: "; p = 1.0-zvalue; t += "1 - " + nf(zvalue, 1, 4) + " = " + nf(p, 1, 4)+"."; drawStrings(t, 80, 379, 25); } else if (rel == 1) { t = "Thus, the p-value equals the left-tailed value: "; p = zvalue; t += nf(p, 1, 4)+"."; text(t, 80, 379); } else { t = "Thus, the p-value equals the 2 times the minimum of the left-tailed and right-tailed values: "; if (zvalue<0.5) { p = 2.0*zvalue; t += "2 * " + nf(zvalue, 1, 4) + " = " +nf(p, 1, 4)+"."; } else { p = (1.0-zvalue)*2.0; t += "2 * (1 - " + nf(zvalue, 1, 4) + ") = " + nf(p, 1, 4)+"."; } drawStrings(t, 80, 379, 25); } if (p<0.05) { t = "Conclusion: Reject the null hypothesis"; } else { t= "Conclusion: Can not reject the null hypothesis"; } text(t, 170, 435); t = "THE END. Click the right arrow for a new problem"; text(t, 150, 470); bg.setVisible(true); bl.setVisible(true); bd.setVisible(true); }