void page2() { String t = "Step 2"; textFont(myboldfont, 18); text(t, 30, 110); textFont(myfont, 18); if (aStudy.testvalue>0) { if (aStudy.k == 0) { generateGraph(0, true, 1); image(pg, 400, 150); t = "Since the right-tailed value equals the total probability, which is 1, minus the left-tailed value:"; drawStrings(t, 30, 140, 25); t = "1-" + critical[s] + " = " + nf(1-critical[s], 1, 4); text(t, 180, 190); t = "1-" + critical[s+1] + " = " + nf(1-critical[s+1], 1, 4); text(t, 180, 220); t = "Therefore, the right-tailed p-value of "+ nf(aStudy.testvalue, 1, 4) + " (in green) is between " + nf(1-critical[s+1], 1, 4) + " and " + nf(1-critical[s], 1, 4); drawStrings(t, 30, 250, 25); } else if (aStudy.k == 2) { generateGraph(0, true, 1); image(pg, 400, 150); generateGraph(2, true, 2); image(pg, 450, 260); t = "Since the right-tailed value equals the total probability, which is 1, minus the left-tailed value:"; drawStrings(t, 30, 140, 25); t = "1-" + critical[s] + " = " + nf(1-critical[s], 1, 4); text(t, 180, 190); t = "1-" + critical[s+1] + " = " + nf(1-critical[s+1], 1, 4); text(t, 180, 220); t = "The right-tailed p-value of "+ nf(aStudy.testvalue, 1, 4) + " (in green) is between " + nf(1-critical[s+1], 1, 4) + " and " + nf(1-critical[s], 1, 4); drawStrings(t, 30, 250, 25); t = "Multiply that by two, we get the two-tailed value:"; text(t, 30, 280); t = "2*" + nf(1-critical[s], 1, 4) + " = " + nf(2*(1-critical[s]), 1, 4); text(t, 180, 310); t = "2*" + nf(1-critical[s+1], 1, 4) + " = " + nf(2*(1-critical[s+1]), 1, 4); text(t, 180, 340); t = "Therefore, the two-tailed p-value of " + nf(aStudy.testvalue, 1, 4) + " (in blue) is between " + nf(2*(1-critical[s+1]), 1, 4)+ " and " +nf(2*(1-critical[s]), 1, 4) ; drawStrings(t, 30, 380, 25); } else { generateGraph(1, true, 1); image(pg, 200, 170); t = "Therefore, the left-tailed p-value of " + nf(aStudy.testvalue, 1, 4) + " (in green) is between " + critical[s] + " and " + critical[s+1]; drawStrings(t, 30, 140, 25); } } else { if (aStudy.k == 0) { generateGraph(0, false, 2); image(pg, 200, 170); t = "Therefore, the right-tailed p-value of " + nf(aStudy.testvalue, 1, 4) + " (in blue) is also between " + critical[s] + " and " + critical[s+1]; drawStrings(t, 30, 140, 25); } else if (aStudy.k == 1) { generateGraph(0, true, 1); image(pg, 400, 150); generateGraph(1, false, 2); image(pg, 200, 280); t = "Since the right-tailed value equals the total probability, which is 1, minus the left-tailed value:"; drawStrings(t, 30, 140, 25); t = "1-" + critical[s] + " = " + nf(1-critical[s], 1, 4); text(t, 180, 190); t = "1-" + critical[s+1] + " = " + nf(1-critical[s+1], 1, 4); text(t, 180, 220); t = "The right-tailed value of " + nf(abs(aStudy.testvalue), 1, 4) + " (in green) is between " + nf(1-critical[s+1], 1, 4) + " and " + nf(1-critical[s], 1, 4); drawStrings(t, 30, 250, 25); t = "Therefore, the left-tailed value of " + nf(aStudy.testvalue, 1, 4) + " (in blue) is also between " + nf(1-critical[s+1], 1, 4) + " and " + nf(1-critical[s], 1, 4); drawStrings(t, 30, 380, 25); } else { generateGraph(0, true, 1); image(pg, 400, 150); generateGraph(2, true, 2); image(pg, 450, 260); t = "Since the right-tailed value equals the total probability, which is 1, minus the left-tailed value:"; drawStrings(t, 30, 140, 25); t = "1-" + critical[s] + " = " + nf(1-critical[s], 1, 4); text(t, 180, 190); t = "1-" + critical[s+1] + " = " + nf(1-critical[s+1], 1, 4); text(t, 180, 220); t = "The right-tailed p-value of "+ nf(abs(aStudy.testvalue), 1, 4) + " (in green) is between " + nf(1-critical[s+1], 1, 4) + " and " + nf(1-critical[s], 1, 4); drawStrings(t, 30, 250, 25); t = "Multiply that by two, we get the two-tailed value:"; text(t, 30, 280); t = "2*" + nf(1-critical[s], 1, 4) + " = " + nf(2*(1-critical[s]), 1, 4); text(t, 180, 310); t = "2*" + nf(1-critical[s+1], 1, 4) + " = " + nf(2*(1-critical[s+1]), 1, 4); text(t, 180, 340); t = "Therefore, the two-tailed p-value of " + nf(aStudy.testvalue, 1, 4) + " (in blue) is between " + nf(2*(1-critical[s+1]), 1, 4)+ " and " +nf(2*(1-critical[s]), 1, 4) ; drawStrings(t, 30, 380, 25); } } t = "THE END. Click the right arrow for a new problem"; text(t, 150, 450); leftarrow.setVisible(true); rightarrow.setVisible(true); }