void page5() { background(255); String t = "Step 4 - The p-value (continued)"; textFont(myboldfont, 18); text(t, 30, 40); textFont(myfont, 18); if (aStudy.k==0) { t = "Since the alternative is left-tailed, we use the formula: "; text(t, 30, 70); image(p1, 80, 100); generateGraph(testl, 1, 0); image(pg, 400, 100); t = "p_ = " + nf(pl, 1, 4); text(t, 80, 150); pvalue = pl; t = "Thus, the p-value equals " + nf(pvalue, 1, 4)+"."; text(t, 30, 200); } else if (aStudy.k==1) { t = "Since the alternative is right-tailed, we use the formula: "; text(t, 30, 70); image(p2, 80, 100); generateGraph(testu, 0, 0); image(pg, 400, 100); t = "p+ = 1 - " + nf(pu, 1, 4) + " = " + nf(1-pu, 1, 4); text(t, 80, 150); pvalue = 1-pu; t = "Thus, the p-value equals " + nf(pvalue, 1, 4)+"."; text(t, 30, 200); } else { t = "Since the alternative is two-tailed, we use these formulas: "; text(t, 30, 70); image(p1, 80, 100); generateGraph(testl, 1, 0); image(pg, 400, 100); t = "p_ = " + nf(pl, 1, 4); text(t, 80, 150); image(p2, 80, 200); generateGraph(testu, 0, 1); image(pg, 400, 200); t = "p+ = 1 - " + nf(pu, 1, 4) + " = " + nf(1-pu, 1, 4); text(t, 80, 250); image(p3, 80, 300); if (pl < 1-pu) { pvalue = 2*pl; } else { pvalue = 2*(1-pu); } t = "p± = 2 * " + nf(pvalue/2, 1, 4) + " = " + nf(pvalue, 1, 4); text(t, 80, 350); t = "Thus, the p-value equals " + nf(pvalue, 1, 4)+"."; text(t, 30, 400); } }