function standard_z(from, to) {
var x = d3.range(from, to + 0.005, 0.01);
var normal = [];
x.forEach((val, i) => {
normal.push({"x": val, "y": jStat.normal.pdf(val, 0, 1), "lab": "Standard Normal"});
})
return normal;
}
function critical_val(C) {
var val = jStat.normal.inv((100 - C) / 2 / 100, 0, 1);
return [val, -1 * val]
}
function conf_region(C) {
var cutoffs = critical_val(C);
var x = d3.range(cutoffs[0], cutoffs[1] + 0.005, 0.01);
var result = [];
x.forEach((val, i) => {
result.push({"x": val, "y": jStat.normal.pdf(val, 0, 1), "lab": "Standard Normal"});
});
return result;
}
Plot.plot({
marks: [
Plot.areaY(conf_region(C),
{
x: "x",
y: "y",
fillOpacity: 0.3
}
),
Plot.line(standard_z(-4, 4),
{
x: "x",
y: "y",
stroke: "lab",
strokeWidth: 3
}
),
Plot.ruleX([critical_val(C)[0]]),
Plot.ruleX([critical_val(C)[1]]),
Plot.text([{"x": critical_val(C)[0] + 0.4, "y": 0.35}, {"x": critical_val(C)[1] - 0.4, "y": 0.35}], {x: "x", y:"y", text: ["-|z*| = " + critical_val(C)[0].toFixed(2), "|z*| = " + critical_val(C)[1].toFixed(2)]})
],
x: { label: "z" },
y: {domain: [0, .41],
label: "Density"},
color: {
legend: true
},
caption: "Standard Normal Distribution"
})
Appendix C — \(z^\ast\) Critical Values
When constructing confidence intervals, we need the value \(z^\ast\) such that \(C\)% of the estimated sampling distribution is between \(-|z^\ast|\) and \(|z^\ast|\). In other words, imagine:
So if we want to \(z\) that corresponds to the confidence level, we have to determine the area of the left/right tail that corresponds to the confidence level. We know that if there’s \(C\)% in the middle, then there’s \(100\% - C\) left in the two tails. For one tail, that’ll be \(\frac{100\% - C}{2}\).
Look up that proportion in Table A in the middle of the table, take the larger value if it’s not on there specifically, and back track to the margins to get your desired value of \(z^\ast\).
The sign of any critical value does not matter, so just take the absolute value as your critical value.
C.1 Examples
- 90% confidence
Find that the area that we want is: \(\frac{100\% - 90%}{2} = 5\% = 0.05\)
Try to find 0.05 in the middle of Table A and you notice that it is between 0.0505 and 0.0495.
Take the larger value, 0.0505 and look at the margins for the \(z\) that corresponds to it, -1.64.
Just take the positive value, \(z^\ast = 1.64\).
Alternatively, do the calculator command invNorm(0.05)
to get a value of around -1.64. Take the positive value as your critical value, \(z^\ast = 1.64\).
- 99% confidence
Find that the area that we want is: \(\frac{100\% - 99%}{2} = 0.5\% = 0.005\)
Try to find 0.005 in the middle of Table A and you notice that it is between 0.0051 and 0.0049.
Take the larger value, 0.0051 and look at the margins for the \(z\) that corresponds to it, -2.57.
Just take the positive value, \(z^\ast = 2.57\).
Alternatively, do the calculator command invNorm(0.005)
to get a value of around -2.5758. Take the positive value as your critical value, \(z^\ast = 2.58\).