Questions about the tail area of a Normal curve are particularly bad because the Empirical Rule puts 2.5% in a tail when z=2, but actually it's 2.275...%. So that's quite an error tolerance you'd be trying to universally impart. If you did so successfully, you'd probably have a hugely unnecessary tolerance in other versions of the problem.

As I see it, in a lot of these stats problems, there are often three answers that students might come to:

- one based on a Normal table (where rounding has occurred)
- one based on exact values using a calculator or stats software
- sometimes, one based on the Empirical Rule

If an instructor has no preference, they should calculate all three in the code for the problem, and use the OneOf construct from my previous post.

If an instructor has a preference, a great approach would be to still calculate all three possibilities, then use the preference as "the" answer, and then use answerHints.pl to give custom feedback for the other answers. I'm not sure it's quite right for the student to be told they are outright wrong when they submit one of the other two approaches, which can leave them feeling confused if they followed a textbook or online example without error. With answerHints.pl, they could get a feedback message like "Ah, it looks like you used technology to find your answer, but I want you to do this kind of problem using the Normal table."

Here's an example of such a problem, with all the constructs. I'm afraid if your instructors are modifying OPL problems, the variety of coding techniques used in OPL stats problems is wide, and they'll have to treat them as they come. But maybe the pieces here can be cut and adapted. Also, this uses Davide Cervone's contextPercent.pl, which I believe is still not distributed, so I've attached it.

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"answerHints.pl",

"PGnumericalmacros.pl",

"PGstatisticsmacros.pl",

"contextPercent.pl",

"parserOneOf.pl",

"PGcourse.pl",

);

##############################################

Context("Percent"); #answers may be entered as "0.3" or "30%" for example; by default error tolerance in this context is absolute to 0.0005=0.05%. Below, based on the answer, I'll change it to something appropriate given the answer.$mu = random(65, 75, 1);

$sigma = random(4, 10, 1);

do {

$examscore = random(60,80,1);

$z = ($examscore - $mu) / $sigma;

} until (abs($z) > 0.2);

$techAns = normal_prob(-infty, $z, mean=>0, deviation=>1);

#set context settings for an appropriate tolerance and number of displayed decimals

Context()->flags->set(tolerance=>abs(10**floor(log($techAns)/log(10))/200));

Context()->flags->set(decimalPlaces=>abs(floor(log($techAns)/log(10))));

$roundedz = round($z*100)/100;

$tableAns = normal_prob(-infty, $roundedz, mean=>0, deviation=>1);

$empAns = $ableAns; #in case the Empirical Rule doesn't apply

if ( grep( $roundedz, (-3, -2, -1, 0, 1 ,2 , 3) ) )

{%emp = (-3 => 0.0015,

-2 => 0.025,

-1 => 0.16,

0 => 0.5,

1 => 0.84,

2 => 0.975,

3 => 0.9985);

$empAns = $emp{$roundedz};

};

$allInclusinveAns = OneOf(

Percent($techAns),

Percent($tableAns),

Percent($empAns)); #in case an instructor is not picky, use this in the ANS call

##############################################

TEXT(beginproblem());

BEGIN_PGML

Scores from an exam taken by thousands of people were Normally distributed with mean [`[$mu]`] and standard deviation [`[$sigma]`]. One person scored a [`[$examscore]`]; what percentage of test takers did they score higher than?

[____________]

END_PGML

##############################################

#if the instructor is not picky

#ANS($allInclusinveAns->cmp());

#if say, the instructor wants the table-based answer

ANS(Percent($tableAns)->cmp()->withPostFilter(AnswerHints(

Percent($tableAns) => "Correct!",

#give feedback for correct first, or else one of the later messages might appear even when correct

Percent($techAns) => "It looks like you used technology; use the table of Normal values instead.",

Percent($empAns) => "It looks like you used the Empirical Rule; use the table of Normal values instead.",

)));

##############################################

BEGIN_PGML_SOLUTION

Walk the student through a solution here...

END_PGML_SOLUTION

ENDDOCUMENT();