void page5() { String t = "Step 5 - The P-value"; textFont(myboldfont, 18); text(t, 30, 194); 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 at row 3.6 and column 0.09."; drawStrings(t, 80, 244, 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 at row -3.6 and column 0.09."; drawStrings(t, 80, 244, 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, 80, 244, 25); } if (row<0) { zvalue = (float)(Probability.normcdf(row-col)); } else { zvalue = (float)(Probability.normcdf(row+col)); } text(nf(col, 1, 2), 343, 310); text(nf(row, 1, 1), 230, 384); text(nf(zvalue, 1, 4), 330, 383); image(smalldown, 345, 325); image(smallright, 280, 360); } 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. The table tells us that 2.5% of the area is to the right of " + nf(tcomp, 1, 4)+"."; drawStrings(t, 80, 244, 25); text("t_k,0.975", 340, 340); } 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. The table tells us that 5% of the area is to the right of " + nf(tcomp, 1, 4)+"."; drawStrings(t, 80, 244, 25); text("t_k,0.95", 340, 340); } text("k=" + nf(aStudy.samplesize-1, 1), 230, 414); text(nf(tcomp, 1, 4), 330, 414); image(smalldown, 345, 355); image(smallright, 280, 390); } }