## WeBWorK Problems

### Re: Multiple choice in tables and tables do not export well

by Hedley Pinsent -
Number of replies: 0
Well thank you.

The TEXT($BEGIN_ONE_COLUMN); and TEXT($END_ONE_COLUMN); has done the trick.

I will look at "Column Table()" a little later; it may offer some improvements.

I may use "one column" for all of the problems in the homework sets; very rarely are they printed and those that do may like the extra space to jot things down.

Students no longer like paper; they do them on their cell phones. Some will even do "theirs" in class while you are explaining another.

I will be surviving an era using "TEXT($BEGIN_ONE_COLUMN);". Applets are presently being developed to convert what the user sees on the screen to presentable printed output. The world is in the process of looking after us. The modified example is below [ note that the storyline comes from "Lind, Marchal, and Wathen" Statistical Techniques in Business and Economics] ## DESCRIPTION ## Statistics ## ENDDESCRIPTION ## KEYWORDS('Statistics','Distribution') ## Tagged by ## DBsubject('Statistics') ## DBchapter('Sampling Distributions and the Central Limit Theorem') ## DBsection('Sample Mean') ## Date('') ## Author('') ## Institution('CNA') ## TitleText1('') ## EditionText1('') ## AuthorText1('') ## Section1('') ## Problem1('') # # First comes some stuff that appears at the beginning of every problem # DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PG.pl", "MathObjects.pl", "PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", "PGauxiliaryFunctions.pl", "PGasu.pl", "PGstatisticsmacros.pl", "PGnumericalmacros.pl", ); TEXT($BEGIN_ONE_COLUMN,beginproblem()) ;

$alpha = list_random(0.01,0.05,0.10,0.20); #upper tailed test$zCritical = normal_distr(0.5 - $alpha);$mean = random( 4, 10, 1);
$zTest =$zCritical;
while ( abs ($zTest -$zCritical) < 0.02){$zTest = random (0.5, 2.8, 0.1)};$n = random (20,50,5);
#$sign = list_random(1,-1);$sign = 1.0 ;
$sigma = list_random (0.3,0.4,0.5,0.6,0.7,0.8);$xCritical = $mean +$sign * $zCritical *$sigma / sqrt $n; #we round away from the critical values ####if($zTest * $sign >$zCritical * $sign){ ####$xbar = int( 1.0 + 100 * ($mean +$sign * $zTest *$sigma ))/100;
####} else {
####$xbar = int( 100 * ($mean + $sign *$zTest * $sigma ))/100;}$xbar = int( 100 * ($mean +$sign * $zTest *$sigma/sqrt $n ))/100; #recalculating z$zTest = ($xbar -$mean)/($sigma / sqrt$n);

$mcnull = new_multiple_choice();$mcnull->qa(
"",
"$$\mu$$"
);
$mcnull->extra( "$$\bar x$$", "$$p$$","$$\bar p$$", );$mcnullEQ = new_multiple_choice();
$mcnullEQ->qa( "", "$$\le$$" );$mcnullEQ->extra(
"$$\ge$$",
"$$\ne$$","$$\gt$$","$$\lt$$" ,"$$=$$"
);

$mcalt = new_multiple_choice();$mcalt->qa(
"",
"$$\mu$$"
);
$mcalt->extra( "$$\bar x$$", "$$p$$","$$\bar p$$", );$mcaltEQ = new_multiple_choice();
$mcaltEQ->qa("" , "$$\gt$$" );$mcaltEQ->extra(
"$$\le$$",
"$$=$$","$$\lt$$", "$$\ne$$","$$\ge$$"
);

##SETTING UP THE TABLE

@r1 = ("$$H_0$$", $mcnull->print_a() ,$mcnullEQ->print_a(),NAMED_ANS_RULE("mu1",6));
@r2 = ("$$H_1$$",$mcalt->print_a(),$mcaltEQ->print_a(),NAMED_ANS_RULE("mu2",6) );

$mcTestStatistic = new_multiple_choice();$mcTestStatistic->qa(
"The test statistic is",
"$$z$$"
);
$mcTestStatistic->extra( "$$t$$", "$$F$$","$$\chi^2$$", ); # Test Statistics choices$mctestEQ = new_multiple_choice();
$mctestEQ->qa( "", "$$\gt$$" );$mctestEQ->extra("$$\lt or \gt$$". " -/+"
,
"$$\lt$$"
);

@r3 = ("We reject if: ", $mcTestStatistic->print_a() ,$mctestEQ->print_a(),NAMED_ANS_RULE("zCrit",6));

$mcAR = new_multiple_choice(); ## this is a two-tailed test$testStatistic = 0; # for now
if( abs($zTest) >abs ($zCritical) ){$mcAR->qa( "We", "reject" );$mcAR->extra(
"do not reject"
);}
else{$mcAR->qa( "We", "do not reject" );$mcAR->extra(
"reject"
);}

BEGIN_TEXT
The mean annual turnover rate of the 200-count bottle of Bayer Aspirin is $mean with a standard deviation of$sigma. (This indicates that the stock of Bayer Aspirin turns over on the pharmacy shelves an average of $mean times per year.) It is suspected that the mean turnover has changed and is more than$mean. $PAR A random sample of$n of the 200-count Bayer Aspirin showed a mean of $xbar.$PAR
Use the $alpha significance level to test the hypothesis that the turnover rate has increased.$PAR

\{begintable(4)\}

\{row( @r1)\}
\{row( @r2)\}

\{endtable()\}

$PAR$PAR
$$\alpha$$ = \{NAMED_ANS_RULE("alpha",6)\} $PERCENT$BR

$BR \{begintable(4)\} \{row( @r3)\} \{endtable()\}$PAR
The value of the test statistic is \{NAMED_ANS_RULE("zTest",6)\} $PAR \{$mcAR->print_q()\}
\{$mcAR->print_a()\}$PAR
The p-value is \{NAMED_ANS_RULE("pValue",6)\} $PERCENT END_TEXT #CHECKING FIRST ROW H0 ANS( radio_cmp($mcnull->correct_ans() ) );
ANS( radio_cmp( $mcnullEQ->correct_ans() ) ); NAMED_ANS(mu1=>num_cmp($mean, mode=>"arith", reltol=>.01));

#CHECKING SECOND ROW H1
ANS( radio_cmp( $mcalt->correct_ans() ) ); ANS( radio_cmp($mcaltEQ->correct_ans() ) );
NAMED_ANS(mu2=>num_cmp( $mean, mode=>"arith", reltol=>.01)); #checking alpha in percent NAMED_ANS(alpha=>num_cmp( 100 *$alpha, mode=>"arith", reltol=>.01));

#CHECKING THIRD ROW
ANS( radio_cmp( $mcTestStatistic->correct_ans() ) ); ANS( radio_cmp($mctestEQ->correct_ans() ) );
NAMED_ANS(zCrit=>num_cmp( $zCritical, mode=>"arith", reltol=>2)); #CHECKING FORTH ROW NAMED_ANS(zTest=>num_cmp($zTest, mode=>"arith", reltol=>2));

ANS( radio_cmp( $mcAR->correct_ans() ) );$pValue = normal_prob (abs($zTest),infty); #$Tol = normal_prob ($zTest - 0.02,$zTest);
$Tol = 0.001; NAMED_ANS(pValue=>num_cmp( 100 *$pValue, mode=>"arith", tolerance=>0.5, tolType=>"absolute"));
TEXT(\$END_ONE_COLUMN);
ENDDOCUMENT(); # This should be the last executable line in the problem.