void page4() { String t = "Step 4 - The p-value"; textFont(myboldfont, 18); text(t, 30, 170); textFont(myfont, 18); t = "Use Table A.3 in the back of the book to the find the area to the left of z* under N(0,1)"; t += " following the corresponding row and column (with at least 3 decimal places). Type in the following textbox(s) then click Answer:"; drawStrings(t, 30, 200, 25); float rowl, coll, rowu, colu; if (testl > 3.69) { rowl = 3.6; coll = 0.09; } else if (testl < -3.69) { rowl = -3.6; coll = 0.09; } else { //rowl = int(testl * 10.0) / 10.0; //coll = round(abs(testl-rowl) * 100.0) / 100.0; rowl = float(round(testl*100.0)/10)/10.0; coll = abs(float(round(testl*100.0)%10)/100.0); } if (testu > 3.69) { rowu = 3.6; colu = 0.09; } else if (testu < -3.69) { rowu = -3.6; colu = 0.09; } else { // rowu = int(testu * 10.0) / 10.0; // colu = round(abs(testu-rowu) * 100.0) / 100.0; rowu = float(round(testu*100.0)/10)/10.0; colu = abs(float(round(testu*100.0)%10)/100.0); } if (rowu<0) { pu = (float)(Probability.normcdf(rowu-colu)); } else { pu = (float)(Probability.normcdf(rowu+colu)); } if (rowl<0) { pl = (float)(Probability.normcdf(rowl-coll)); } else { pl = (float)(Probability.normcdf(rowl+coll)); } if (aStudy.k==0) { text(nf(coll, 1, 2), 230, 280); text(nf(rowl, 1, 2), 100, 345); image(smalldown, 230, 290); image(smallright, 150, 320); text("Z_l", 170, 300); tf3.setVisible(false); } else if (aStudy.k==1) { text(nf(colu, 1, 2), 230, 280); text(nf(rowu, 1, 2), 100, 345); image(smalldown, 230, 290); image(smallright, 150, 320); text("Z_u", 170, 300); tf3.setVisible(false); } else { text(nf(coll, 1, 2), 230, 280); text(nf(rowl, 1, 2), 100, 345); image(smalldown, 230, 290); image(smallright, 150, 320); text("Z_l", 170, 300); text(nf(colu, 1, 2), 500, 280); text(nf(rowu, 1, 2), 370, 345); image(smalldown, 500, 290); image(smallright, 420, 320); text("Z_u", 440, 300); tf3.setVisible(true); } fill(0, 0, 255); drawStrings(feedback, 80, 380, 25); tf2.setXY(200, 330); tf3.setXY(470, 330); }