# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
303 lines (280 sloc) 15.5 KB
 Z scores 3
randRange(0, 3) [4, 5, 8, 10][INDEX] (function() { var zScores = []; if (STDDEV === 8) { var zDecimal1 = randRange(0, 2) * 2; var zDecimal2 = randRange(zDecimal1 / 2 + 1, 3) * 2; } else { var zDecimal1 = randRange(0, STDDEV - 2); var zDecimal2 = randRange(zDecimal1 + 1, STDDEV - 1); } zScores.push(roundTo(2, randRange(0, 2) + zDecimal1 / STDDEV) * randRangeNonZero(-1, 1)); zScores.push(roundTo(2, floorTo(0, abs(zScores[0])) + zDecimal2 / STDDEV) * randRangeNonZero(-1, 1)); return sortNumbers(zScores); })() floorTo(0, abs(ZSCORES[0]) * 10) % 10 (roundTo(0, abs(ZSCORES[0]) * 100)) % 10 floorTo(0, abs(ZSCORES[1]) * 10) % 10 (roundTo(0, abs(ZSCORES[1]) * 100)) % 10 randRange(95, 99) - STDDEV * 3 [MEAN + ZSCORES[0] * STDDEV, MEAN + ZSCORES[1] * STDDEV] (function() { var rowNames = []; for (var i = floorTo(0, abs(ZSCORES[0])); i < (floorTo(0, abs(ZSCORES[0])) + 1); i += 0.1) { rowNames.push(localeToFixed(i, 1)); } return rowNames; })() [.00, .01, .02, .03, .04, .05, .06, .07, .08, .09] (function() { var zGrid = []; for (var i = 0; i < ROWS.length; i++) { var zRow = []; for (var j = 0; j < COLUMNS.length; j++) { zRow.push(zScores(roundTo(2, (floorTo(0, abs(ZSCORES[0])) + i / 10 + j / 100) * 100))); } zGrid.push(zRow); } return zGrid; })() (function() { var a, b; if (ZSCORES[0] >= 0) { a = ZGRID[ROW_INDEX_1][COL_INDEX_1]; } else { a = 1 - ZGRID[ROW_INDEX_1][COL_INDEX_1]; } if (ZSCORES[1] >= 0) { b = ZGRID[ROW_INDEX_2][COL_INDEX_2]; } else { b = 1 - ZGRID[ROW_INDEX_2][COL_INDEX_2]; } return roundTo(4, b - a); })() "z"
The scores on a statewide course( 1 ) exam were normally distributed with \mu = MEAN and \sigma = STDDEV.

Use the cumulative z-table provided below.

rowlocaleToFixed(zgrid, 4)

A cumulative z-table shows the probability that a standard normal variable will be less than a certain value (z).

In order to use the z-table, we first need to determine the z-scores of the two grades which we were given.

Recall that we can calculate the z-scores by subtracting the mean (\mu) from each exam grade and then dividing by the standard deviation (\sigma).

We can find the percentage of test-takers that earned between GRADES[0] and GRADES[1] by finding the area between localeToFixed(ZSCORES[0], 2) and localeToFixed(ZSCORES[1], 2) under the standard normal curve. After looking up these two z-scores in our z-table, subtracting the two table values will provide us with the total area.

init({ range: [[-4, 4], [-1.5, 4.7]], scale: [430 / 8, 30] }); style({ stroke: "#bbb" }, function() { line([-3.5, 0], [3.5, 0]); }); graph.pdf = function(x) { return gaussianPDF(0, 1, x) * 4 / gaussianPDF(0, 1, 0) + 0.2; }; style({ stroke: BLUE }, function() { plot(graph.pdf, [-3.5, 3.5]); });

Since the normal curve is symmetrical, the area less than localeToFixed(ZSCORES[1], 2) is equal to the area greater than localeToFixed(abs( ZSCORES[1] ), 2), which can be found by looking up localeToFixed(abs( ZSCORES[1] ), 2) on the z-table and subtracting the table value from 1, the total area under the curve.

1 - localeToFixed(ZGRID[ ROW_INDEX_2 ][ COL_INDEX_2 ], 4) = localeToFixed(1 - ZGRID[ ROW_INDEX_2 ][ COL_INDEX_2 ], 4). This value, localeToFixed(1 - ZGRID[ ROW_INDEX_2 ][ COL_INDEX_2 ], 4), represents the portion of the population that scored lower than GRADES[1] on the exam.

Look up localeToFixed(ZSCORES[1], 2) on the z-table. This value, localeToFixed(ZGRID[ ROW_INDEX_2 ][ COL_INDEX_2 ], 4), represents the portion of the population that scored lower than GRADES[1] on the exam.

var nth = ":nth-child(" + ( COL_INDEX_2 + 2 ) + ")"; $( ".fake_row" ).eq( ROW_INDEX_2 ).find( "span" + nth ) .css( "background", KhanUtil.BLUE ); style({ stroke: "#bbb" }, function() { graph.zLine1 = line([ZSCORES[1], 0], [ZSCORES[1], graph.pdf(ZSCORES[1])]).toBack(); }); graph.zLabel = label([ZSCORES[1], 0], localeToFixed(ZSCORES[1], 2), "below", { color: "#bbb" }); var step = 1 / 50; blueShape = []; blueShape.push([-3.5, 0]); for (var i = -3.5; i <= ZSCORES[1]; i += step) { blueShape.push([i, graph.pdf(i)]); } blueShape.push([ZSCORES[1], graph.pdf(ZSCORES[1])]); blueShape.push([ZSCORES[1], 0]); blueShape.push([-3.5, 0]); style({ stroke: null, fill: BLUE, opacity: 0.3 }, function() { graph.blueShape = path(blueShape); }); Since the normal curve is symmetrical, the area less than localeToFixed(ZSCORES[0], 2) is equal to the area greater than localeToFixed(abs(ZSCORES[0]), 2), which can be found by looking up localeToFixed(abs(ZSCORES[0]), 2) on the z-table and subtracting the table value from 1, the total area under the curve. 1 - localeToFixed(ZGRID[ROW_INDEX_1][COL_INDEX_1], 4) = localeToFixed(1 - ZGRID[ROW_INDEX_1][COL_INDEX_1], 4). This value, \green{localeToFixed(1 - ZGRID[ROW_INDEX_1][COL_INDEX_1], 4)}, represents the portion of the population that scored lower than GRADES[0] on the exam. Look up localeToFixed(ZSCORES[0], 2) on the z-table. This value, \green{localeToFixed(ZGRID[ ROW_INDEX_1 ][ COL_INDEX_1 ], 4)}, represents the portion of the population that scored lower than GRADES[0] on the exam. var nth = ":nth-child(" + (COL_INDEX_1 + 2) + ")";$(".fake_row").eq(ROW_INDEX_1).find("span" + nth).css("background", GREEN);
style({ stroke: "#bbb" }, function() { graph.zLine2 = line([ZSCORES[0], 0], [ZSCORES[0], graph.pdf(ZSCORES[0])]).toBack(); }); graph.zLabel.remove(); graph.zLabel = label([ZSCORES[0], 0], localeToFixed(ZSCORES[0], 2), "below", { color: "#bbb" }); var step = 1 / 50; graph.blueShape.remove(); greenShape = []; greenShape.push([-3.5, 0]); for (var i = -3.5; i <= ZSCORES[0]; i += step) { greenShape.push([i, graph.pdf(i)]); } greenShape.push([ZSCORES[0], graph.pdf(ZSCORES[0])]); greenShape.push([ZSCORES[0], 0]); greenShape.push([-3.5, 0]); style({ stroke: null, fill: GREEN, opacity: 0.7 }, function() { graph.greenShape = path(greenShape); }); blueShape = []; blueShape.push([ZSCORES[0], 0]); for (var i = ZSCORES[0]; i <= ZSCORES[1]; i += step) { blueShape.push([i, graph.pdf(i)]); } blueShape.push([ZSCORES[1], graph.pdf(ZSCORES[1])]); blueShape.push([ZSCORES[1], 0]); blueShape.push([ZSCORES[0], 0]); style({ stroke: null, fill: BLUE, opacity: 0.3 }, function() { graph.blueShape = path(blueShape); });

Subtract the two cumulative areas:\blue{ localeToFixed(1 - ZGRID[ROW_INDEX_2][COL_INDEX_2], 4) localeToFixed(ZGRID[ROW_INDEX_2][COL_INDEX_2], 4) } - \green{ localeToFixed(1 - ZGRID[ROW_INDEX_1][COL_INDEX_1], 4) localeToFixed(ZGRID[ROW_INDEX_1][COL_INDEX_1], 4) } = \pink{localeToFixed(ANSWER, 4)}

Thus, localeToFixed(ANSWER * 100, 2)\% of the test-takers scored between GRADES[0] and GRADES[1] on the course( 1 ) exam.

graph.greenShape.remove(); graph.zLabel.remove();