void page6() { String t = "Step 5 - The P-value"; textFont(myboldfont, 18); text(t, 30, 160); textFont(myfont, 18); float row, col; if ((aStudy.known == 1) || (aStudy.samplesize>30)) { if (testvalue>3.69) { t = "Use Table A.3 in the back of the book to the find the area to the left of z* (left-tailed value). Since z* = " + nf(testvalue, 1, 2) + ", look for the largest value possible, which are row 3.6 and column 0.09"; drawStrings(t, 30, 190, 25); row = 3.6; col = 0.09; } else if (testvalue<-3.69) { t = "Use Table A.3 in the back of the book to the find the area to the left of z* (left-tailed value). Since z* = " + nf(testvalue, 1, 2) + ", look for the smallest value possible, which are row -3.6 and column 0.09"; drawStrings(t, 30, 190, 25); row = -3.6; col = 0.09; } else { row = int(testvalue * 10.0) / 10.0; col = round(abs(testvalue-row) * 100.0) / 100.0; t = "Use Table A.3 in the back of the book to the find the area to the left of z* (left-tailed value). Since z* = " + nf(testvalue, 1, 2) + ", look for row " + nf(row, 1, 1) + " and column " + nf(col, 1, 2); drawStrings(t, 30, 190, 25); } if (row<0) { zvalue = (float)(Probability.normcdf(row-col)); } else { zvalue = (float)(Probability.normcdf(row+col)); } text(nf(col, 1, 2), 393, 292); text(nf(row, 1, 1), 260, 359); } else { zvalue = (float)(Probability.tcdf(testvalue, aStudy.samplesize-1)); if (aStudy.k == 2) { tcomp = (float)Probability.tinv(0.975, aStudy.samplesize-1); t = "Use Table A.4 in the back of the book to the estimate the right-tailed value of t*. Since this is two-tailed, look for row n - 1 = " + nf(aStudy.samplesize-1, 1) + " and column t_k,0.975."; drawStrings(t, 30, 190, 25); text("t_k,0.975", 370, 295); } else { tcomp = (float)Probability.tinv(0.95, aStudy.samplesize-1); t = "Use Table A.4 in the back of the book to the estimate the right-tailed value of t*. Since this is one-tailed, look for row n - 1 = " + nf(aStudy.samplesize-1, 1) + " and column t_k,0.95."; drawStrings(t, 30, 190, 25); text("t_k,0.95", 385, 290); } text("k = " + nf(aStudy.samplesize-1, 1), 250, 359); } tf3.setXY(360,342); image(smalldown, 395, 300); image(smallright, 310, 335); t = "What do you find in the table? Type in the following textbox (with at least 3 decimal places) then click Answer:"; drawStrings(t, 30, 260, 25); fill(0, 0, 255); drawStrings(feedback, 30, 389, 25); tf3.setVisible(true); cb6.setVisible(false); }