WeBWorK Main Forum

The evaluated answer is not an answer hash : ||.

The evaluated answer is not an answer hash : ||.

by tim Payer -
Number of replies: 9

I just recently got this warning message in a problem that has worked for years:

The evaluated answer is not an answer hash : ||.

I searched the Forums pages and there are six instances on the Forum, but no solutions or replies on what to do with this error.

Please help.


Below is the rather long code block from which the Warning error came:

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

##DESCRIPTION

## ANOVA, SNK test

##ENDDESCRIPTION


## KEYWORDS('anova', 'snk test')


## DBsubject('Statisitics')

## DBchapter('confidence intervals')

## DBsection('Real Numbers')

## Date('11/7/2016')

## Author('Tim Payer')

# DESCRIPTION  ANOVA, SNK test

# Use correct notation.

# WeBWorK problem written by TimPayer <tsp1@humboldt.edu>

# ENDDESCRIPTION


## DBsubject(Probability)

## DBchapter(Random variables)

## DBsection(Expectation)

## Institution(Humboldt State University)

## Author(Tim Payer)

## KEYWORDS(probability, translate, notation)

DOCUMENT();


loadMacros(

"PGstandard.pl",

"PGunion.pl",

"PGnumericalmacros.pl",

"PGstatisticsmacros.pl",

"MathObjects.pl",

"parserPopUp.pl",

"PGML.pl",

"unionTables.pl",

"niceTables.pl",

"PGcourse.pl",

"PGchoicemacros.pl",

  "answerHints.pl",

"weightedGrader.pl"

);


install_weighted_grader();


TEXT(beginproblem()); 


#install_problem_grader(~~&std_problem_grader);

$showPartialCorrectAnswers = 1;


Context("Numeric");

Context()->flags->set(

  tolerance => 0.01,

  tolType => "absolute",

);


## Note that the wide tolerance was preventing a correct bracketing of the 

## p-value for $fsamh. knocking the tolerance back down redirects the issue

## toward generating a correct SSW value and direct calculation may be needed..

############ Start Problem 25.1  ##################


### Summarized Data table values:

@nn =();

$nn[0] = Compute("1");

$nn[1] = Compute("2");

$nn[2] = Compute("3");

$nn[3] = Compute("4");


### sample size per group:

@nr =();

$nr[0] = random(19,25,1);

$nr[1] = random(68,77,1);

$nr[2] = random(70,82,1);

$nr[3] = random(9,13,1); ## widen from (9, 13) which was producing a tiny sd?


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

## This next block generates raw data for each group

## and then finds the summarizing values of the mean and sd.

## Start with an empty array and subtract one to account for 

## arrays that start at zero to mesh with sample size:

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


## Site 1

@cont = ();  

foreach my $i ( 0..$nr[0] - 1 ) {

    $cont[$i] = random(4.6, 12.6,0.01);   # diff = 8

}

$contm = stats_mean(@cont);

$conts = stats_sd(@cont);

$control = join(", ",@cont);



## Site 2

@flea = ();

foreach my $i ( 0..$nr[1] - 1 ) {

     $flea[$i] = random(2.51,11.51,0.01); # diff = 9

}

$fleam = stats_mean(@flea);

$fleas = stats_sd(@flea);

$fleab = join(", ",@flea);


## Site 3

@copb = ();

foreach my $i ( 0..$nr[2] - 1 ) {

     $copb[$i] = random(3.10,13.1,0.01);  # diff = 10

}

$copbm = stats_mean(@copb);

$copbs = stats_sd(@copb);

$copbb = join(", ",@copb);


## Site 4

@ww = ();

foreach my $i ( 0..$nr[3] - 1 ) {

     $ww[$i] = random(9.50, 19.5,0.01);  # diff = 10

}

###  I need to have a check in the loops above to prevent small sds

###  from occurring as they will tend cause Hartley test to fail when

###  other sds are large. That is,

###  the F-sample will be too large relative to the F-critical.

###  Then the check must be for a wide enough range to anticipate the

###  comparitive sd values for the F-max test?

$wwm = stats_mean(@ww);

$wws = stats_sd(@ww);

$wwb = join(", ",@ww);



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


@sr =();

$sr[0] = sprintf("%0.1f",$conts);

$sr[1] = sprintf("%0.1f",$fleas);

$sr[2] = sprintf("%0.1f",$copbs);

$sr[3] = sprintf("%0.1f",$wws);


####  Finding the largest and smallest sd for F-max test:

my $index = 0;

my $maxsd = $sr[ my $index ];

for ( 0 .. 3 )

{

    if ( $maxsd < $sr[$_] )

    {

        $index = $_;

        $maxsd = $sr[$_];

    }

}


$mxsd = $maxsd;



my $index = 0;

my $minsd = $sr[ my $index ];

for ( 0 .. 3 )

{

    if ( $minsd > $sr[$_] )

    {

        $index = $_;

        $minsd = $sr[$_];

    }

}


$mnsd = $minsd;


######  Rounding Sample means....

@xr =();

$xr[0] = sprintf("%0.1f",$contm);

$xr[1] = sprintf("%0.1f",$fleam);

$xr[2] = sprintf("%0.1f",$copbm);

$xr[3] = sprintf("%0.1f",$wwm);




$jnn = join("$BR ",@nn);

$jn = join("$BR ",@nr);

$jx = join("$BR ",@xr,);

$js = join("$BR ",@sr);


$trial = random(3, 9, 1);

## Preliminary Checks:  Step 1 ####


$popup1 = PopUp(

["Choose:", 'independent', 'dependent'], 'independent');


$popup2 = PopUp(

["Choose:", 'pass', 'fail'], 'pass');


## Preliminary Checks:  Step 1b, Equal variances ####


$nprime = Compute("4/(1/$nr[0]+1/$nr[1]+1/$nr[2]+1/$nr[3])");

$npff =floor($nprime);

$npf = Compute("$npff");

$npc = Compute("$npff+1");


$popup5 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Do Not Reject');


$popup6 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Reject');


$popup7 = PopUp(

["??", '40%','20%','10%', '5%','2.5%', '2%', '1%', '0.1%', '0.01%'], '5%');


$popup8 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Do Not Reject');



##### Older code for previous-pre-matrix attempts  ####

$dfhn =Compute("4");       ## Delete when replaced

$dfhd =Compute("$npf");    ## Delete when replaced

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


## Using a matrix to determine F-critical for Hartleys test, alpha = 0.05

##  Listing the F-Critical values for Hartley's with df = (4, 20:28)


$M1 = Matrix([2.46, 2.87, 3.28, 3.84, 4.29, 5.99], [2.41, 2.79, 3.18, 3.71, 4.13, 5.71], [2.36, 2.72, 3.09, 3.59, 3.99, 5.46], [2.31, 2.66, 3.01, 3.49, 3.86, 5.24], [2.27, 2.60, 2.94, 3.39, 3.74, 5.04], [2.23, 2.55, 2.87, 3.30, 3.64, 4.86], [2.19, 2.50, 2.81, 3.22, 3.54, 4.70], [2.16, 2.46, 2.75, 3.15, 3.45, 4.55], [2.13, 2.42, 2.70, 3.08, 3.37, 4.42]);


## F-sample for Hartleys: max/min variances based on max/min diff.

$fsamh = Compute("$maxsd**2/$minsd**2");  

$rw =$npf-19;  ## Letting dfw reset from rows 20-28 to rows 1-9

$fcrth = $M1->element($rw, 3);  ## Hartleys F-Critical for 5% 

##### If-then Conditional for bracketing p-value of Hartleys test.

if($fsamh < $M1->element($rw, 1)){

      $pp = "(p > 0.20)";

    } elsif(($M1->element($rw, 1) < $fsamh) && ($fsamh < $M1->element($rw, 2)) ) {

      $pp = "(0.10 < p < 0.20)";

    } elsif(($M1->element($rw, 2) < $fsamh) && ($fsamh < $M1->element($rw, 3)) ) {

      $pp = "(0.05 < p < 0.10)";

    } elsif(($M1->element($rw, 3) < $fsamh) && ($fsamh < $M1->element($rw, 4)) ) {

      $pp = "(0.02 < p < 0.05)";

    } elsif(($M1->element($rw, 4) < $fsamh) && ($fsamh < $M1->element($rw, 5)) ) {

      $pp = "(0.01 < p < 0.02)";

    } elsif(($M1->element($rw, 5) < $fsamh) && ($fsamh < $M1->element($rw, 6)) ) {

      $pp = "(0.001 < p < 0.01)";

    } else{

     $pp = "(p < 0.001)";

}




$popup9 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '<');


$popup99 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '<');



$popup19 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popupph = PopUp(

["which bracketed p-value?",

"(p > 0.40)", "(p > 0.20)","(0.20 < p < 0.40)","(0.10 < p < 0.20)", "(0.05 < p < 0.10)", "(0.025 < p < 0.05)", "(0.02 < p < 0.05)", "(0.01 < p < 0.025)","(0.01 < p < 0.02)",  "(0.005 < p < 0.01)",  "(0.001 < p < 0.01)", "(0.0001 < p < 0.001)", "(p < 0.01)", "(p < 0.001)", "(p < 0.0001)"], $pp );


####   this Should hold $pp as an answer above instead of "(p > 0.20)"  ??

$popup29 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popup10 = PopUp(

["alpha",  '0.20','0.10', '0.05', '0.02', '0.01', '0.001', '0.0001'], '0.05');


$popup11 = PopUp(

["??", 'all met, we can proceed', 'not met, we can not proceed', 'mostly met, we can proceed'], 'all met, we can proceed');


## IF needed and array sequence for Hartleys F test:

$fr = list_random(0, 1, 2, 3, 4, 5, 6);  ## permits random selections of a specified range.

@falfa = ( '0.20','0.10', '0.05','0.02', '0.01', '0.001', '0.0001');

@falfap = ( '20%','10%', '5%','2%', '1%', '0.1%', '0.01%');



### Declaration of Variables: Step 2  ####


$popup3 = PopUp(

["Choose:",   'x-bar-i', 'mu-i', 'x-tilde-i', 'eta-i'], 'mu-i');


$popup4 = PopUp(

["Choose:", 'mean', 'median','standard deviation of', 'proportion of'], 'mean');


### Declaration of Hypothesis: Step 3  ####


$popup30 = PopUp(

["??", 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'], 'D');


$popup31 = PopUp(

["??", 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'], 'C');


$r = list_random(0, 1, 2, 3, 4, 5, 6);  ## permits random selections of a specified range.

@alfa = ( '0.20','0.10', '0.05','0.02', '0.01', '0.001', '0.0001');

@alfap = ( '20%','10%', '5%','2%', '1%', '0.1%', '0.01%');

$alfp = "$alfap[$r]";


$LOS =Compute("100*$alfa[$r]");

$poplos = PopUp(

["alpha", '0.40', '0.20','0.10', '0.05','0.025', '0.02', '0.01', '0.001', '0.0001'], $alfa[$r]);


###  Calculate values for ANOVA Table: Step 4


$h1=0;

foreach my $i (0..3) {

   $sm1 =Compute("$h1 + $nr[$i]");   ## Summing all sample sizes

   $h1 = $sm1;

}


$h2=0;

foreach my $i (0..3) {

   $sm2 =Compute("$h2 + $nr[$i]*$xr[$i]");   ## Summing all n*xbars 

   $h2 = $sm2;

}


$gm2 =Compute("$sm2/$sm1");   ## the grand mean


$h3=0;

foreach my $i (0..3) {

   $sm3 =Compute("$h3 + $nr[$i]*($xr[$i]-$gm2)**2");   ## Summing to ssb 

   $h3 = $sm3;

}


$h4=0;

foreach my $i (0..3) {

   $sm4 =Compute("$h4 + ($nr[$i]-1)*($sr[$i])**2");   ## Summing to SSW

   $h4 = $sm4;

}


$ssb=Compute("$sm3");

#$ssw =Compute("$sm4");

$ssw2 =Compute("$sm4");

$ssw1 =sprintf("%0.1f",$ssw2);

#$ssw =Compute("$ssw1");

$ssw = Compute($ssw1)->with(

  tolType => 'relative',

  tolerance => .005,

);


#$sst = Compute("$ssb+$ssw");

$sst = Compute("$ssb+$ssw")->with(

  tolType => 'relative',

  tolerance => .001,

);

$dfb = Compute("3");

$dfw = Compute("$sm1-4");

$dft = Compute("$dfb+$dfw");

$msb = Compute("$ssb/$dfb");

#$msw = Compute("$ssw/$dfw");

$msw2 = Compute("$ssw/$dfw");

$msw1 = sprintf("%0.3f",$msw2);

$msw = Compute("$msw1");

#$fsam = Compute("$msb/$msw");

$fsam = Compute("$msb/$msw")-> with(

  tolType => 'absolute',

  tolerance => .05, ); ## Wider tolerance x5 to permit some round off errors...


### ### A 2x7 matrix to find f-critical and bracket -p for the ANOVA test.  ####


$M2 = Matrix([1.58, 2.14, 2.70, 3.43, 3.98, 5.86, 7.79], [1.57, 2.12, 2.67, 3.38, 3.92, 5.73, 7.57]);


if(($dfw >= 100) &&($dfw < 140)){

      $ra =1;

     @fcrit =('1.58','2.14', '2.70', '3.43', '3.98', '5.86', '7.79');

      } else{

      $ra =2;

     @fcrit =('1.57','2.12', '2.67', '3.38', '3.92', '5.73', '7.57');

}


@finf =('1.55','2.08', '2.60', '3.28', '3.78', '5.425', '7.04');

$fin = Compute("$finf[$r]");

$fcrt =Compute("$fcrit[$r]");



if($fsam < $M2->element($ra, 1)){

      $pa = "(p > 0.20)";

    } elsif(($M2->element($ra,1) < $fsam) && ($fsam < $M2->element($ra,2)) ) {

      $pa = "(0.10 < p < 0.20)";

    } elsif(($M2->element($ra,2) < $fsam) &&  ($fsam < $M2->element($ra,3)) ) {

      $pa = "(0.05 < p < 0.10)";

    } elsif(($M2->element($ra,3) < $fsam) &&  ($fsam < $M2->element($ra,4)) ) {

      $pa = "(0.02 < p < 0.05)";

    } elsif(($M2->element($ra,4) < $fsam) &&  ($fsam < $M2->element($ra,5)) ) {

      $pa = "(0.01 < p < 0.02)";

    } elsif(($M2->element($ra,5) < $fsam) &&  ($fsam < $M2->element($ra,6)) ) {

      $pa = "(0.001 < p < 0.01)";

     } elsif(($M2->element($ra,6) < $fsam) &&  ($fsam < $M2->element($ra,7)) ) {

      $pa = "(0.0001 < p < 0.001)";

     } else{

     $pa = "(p < 0.0001)";

}



$pop21 = PopUp(

["which bracketed p-value?",

"(p > 0.40)", "(p > 0.20)","(0.20 < p < 0.40)","(0.10 < p < 0.20)", "(0.05 < p < 0.10)", "(0.025 < p < 0.05)", "(0.02 < p < 0.05)", "(0.01 < p < 0.025)","(0.01 < p < 0.02)",  "(0.005 < p < 0.01)",  "(0.001 < p < 0.01)", "(0.0005 < p < 0.005)",  "(p < 0.001)", "(p < 0.0001)"], "(p < 0.0001)" );


##### But $pa should be used above when ready....

#### Write a Statistical conclusion to the ANOVA hypothesis.


$popup40 = PopUp(

["??", '40%','20%','10%', '5%','2.5%', '2%', '1%', '0.1%', '0.01%'], $alfp);


$popup41 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Reject');


@fcrit =('1.57','2.12', '2.67', '3.38', '3.92', '5.73', '7.57');

@finf =('1.55','2.08', '2.60', '3.28', '3.78', '5.42', '7.04');

$fcrt =Compute("$fcrit[$r]");

$fin = Compute("$finf[$r]");


$popup33 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popup34 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popup44 = PopUp(

["??", '<', '>'], '<');


$popup45 = PopUp(

["which bracketed p-value?",

"(p > 0.40)", "(p > 0.20)","(0.20 < p < 0.40)","(0.10 < p < 0.20)", "(0.05 < p < 0.10)", "(0.025 < p < 0.05)", "(0.02 < p < 0.05)", "(0.01 < p < 0.025)","(0.01 < p < 0.02)",  "(0.005 < p < 0.01)",  "(0.001 < p < 0.01)", "(0.0005 < p < 0.005)",  "(p < 0.001)", "(p < 0.0001)"], "(p < 0.0001)" );


$popup46 = PopUp(

["??", '<', '>'], '<');


$popup47 = PopUp(

["alpha", '0.40', '0.20','0.10', '0.05','0.025', '0.02', '0.01', '0.001', '0.0001'], $alfa[$r] );


$popup48 = PopUp(

["Choose:", 'varies', 'does not vary'], 'varies');



####  Begin Problem...


#### M3 is a 30 x 7 Matrix of wrong critical values that students are likely

#### to submit as answers for Hartley's F-max Critical Value. 

#### Flagging these entries will prompt the 

#### student of the type of error made. Note that the F-max table will have

#### duplicate values on the last row as it has one less column than 

#### the ANOVA f-critical values and this is the "mesh" for this case.

####  fcrtw1: Row 1 = used df(3,120), should be df =4 for F-max critical  

####  Wrong F-max: df = (3, 20:28) at rows 2-10,  

####  Wrong F-Critical df = (3, 20:28) at rows 11-19, 

####  Wrong F-Critical (4, 20:28) at rows 20-28, 

####  Wrong F-Critical  Row 29 = df(3,140), Row 30 = df(4,140)


$M3 = Matrix([1.37, 1.46, 1.54, 1.64, 1.71, 1.94, 1.94], [1.63, 1.88, 2.13, 2.46, 2.72, 3.65, 3.65], [2.19, 2.57, 2.95, 3.48, 3.90, 5.50, 5.50], [2.15, 2.51, 2.87, 3.37, 3.76, 5.25, 5.25],[2.11, 2.45, 2.80, 3.27, 3.64, 5.03, 5.03], [2.07, 2.40, 2.73, 3.18, 3.53, 4.84, 4.84], [2.04, 2.35, 2.67, 3.10, 3.43, 4.66, 4.66], [2.01, 2.31, 2.61, 3.02, 3.34, 4.51, 4.51], [1.98, 2.27, 2.56, 2.95, 3.26, 4.36, 4.36], [1.95, 2.24, 2.52, 2.89, 3.18, 4.23, 4.23], [1.93, 2.20, 2.47, 2.83, 3.11, 4.12, 4.12], [1.70, 2.38, 3.10, 4.11, 4.94, 8.10, 12.05], [1.69, 2.36, 3.07, 4.07, 4.87, 7.94, 11.73], [1.68, 2.35, 3.05, 4.03, 4.82, 7.80, 11.44], [1.68, 2.34, 3.03, 3.99, 4.76, 7.67, 11.19], [1.67, 2.33, 3.01, 3.96, 4.72, 7.55, 10.96], [1.66, 2.32, 2.99, 3.93, 4.68, 7.45, 10.76], [1.66, 2.31, 2.98, 3.90, 4.64, 7.36, 10.58], [1.65, 2.30, 2.96, 3.87, 4.60, 7.27, 10.41], [1.65, 2.29, 2.95, 3.85, 4.57, 7.19, 10.26], [1.65, 2.25, 2.87, 3.73, 4.43, 7.10, 10.41], [1.65, 2.23, 2.84, 3.69, 4.37, 6.95, 10.12], [1.64, 2.22, 2.82, 3.65, 4.31, 6.81, 9.86], [1.63, 2.21, 2.80, 3.61, 4.26, 6.70, 9.63], [1.63, 2.19, 2.78, 3.58, 4.22, 6.59, 9.42], [1.62, 2.18, 2.76, 3.55, 4.18, 6.49, 9.24], [1.62, 2.17, 2.74, 3.52, 4.14, 6.41, 9.07],[1.61, 2.17, 2.73, 3.50, 4.11, 6.33, 8.92], [1.61, 2.16, 2.71, 3.47, 4.07, 6.25, 8.79], [1.57, 2.12, 2.67, 3.38, 3.92, 5.73, 7.57], [1.52, 1.99, 2.44, 3.02, 3.46, 4.90, 6.35]);


$fcrtw1 = $M3->element(1, 3);  ##F-max: k=3, dfw = 120,  alpha = 5%

$fcrtw2 = $M3->element(1, $rw-1); ##F-max: k=3, dfw = 120,  alpha = a%

$fcrtw3 = $M3->element($rw+2, 3); ##F-max: k=3, dfw = good,  alpha = 5%

$fcrtw4 = $M3->element($rw+2, $rw-1);  ##F-max: k=3, dfw = good,  alpha = a%

$fcrtw5 = $M3->element($rw+11, 3); ##F-Crit: k=3, dfw = good,  alpha = 5%

$fcrtw6 = $M3->element($rw+11, $rw-1);  ##F-Crit: k=3, dfw = good,  alpha = a%

$fcrtw7 = $M3->element($rw+20, 3); ##F-Crit: k=4, dfw = good,  alpha = 5%

$fcrtw8 = $M3->element($rw+20, $rw-1);  ##F-Crit: k=4, dfw = good,  alpha = a%

$fcrtw9 = $M3->element(30, 3); ##F-Crit: k=3, dfw = 140,  alpha = 5%

$fcrtw10 = $M3->element(30, $rw-1);  ##F-Crit: k=3, dfw = 140,  alpha = a%

$fcrtw11 = $M3->element(31, 3); ##F-Crit: k=4, dfw = 140,  alpha = 5%

$fcrtw12 = $M3->element(31, $rw-1);  ##F-Crit: k=4, dfw = 140,  alpha = a%


BEGIN_PGML 

   *Drawn from Lecture Notes: Week 11 Day 2, Week 12 Day 2, and Week 12 Day 3.*  

  

[@

DataTable(

[

["$BBOLD 25.3)  $EBOLD The bright yellow head of the adult male Egyptian vulture requires carotenoid pigments. The brighter the yellow pigment, the more likely that the male will attract a mate. These pigments can not be synthesized by the vultures, so they must be obtained through their diet. Unfortunately, carotenoids are scarce in rotten flesh and bones, but they are readily available in the dung of ungulates. Which is why Egyptian vultures are frequently seen eating the droppings of cows, goats, and sheep in Spain, where they have been studied.","  ",[" An Egyptian Vulture, $BITALIC Neophron percnopterus $EITALIC".$BR.image( "Yellowhead.png", width=>743, height=>382, tex_size=>700 ).$BR."image by San Diego Zoo Safari Park" ]]], 

  caption => "Does the Carotenoid Pigment of the Egyptian Vulture Vary by Region?",

  midrules=>0, 

  align => "p{3.5in} p{0.1in} p{4.2in}"

);

@]***  

  

  


Ungulates are common in some areas but not in others. Could the variation in yellow pigment coloring of the Egyptian vulture be due to a variation in the availability in ungulate dung? Negro et al. (2002) measured plasma carotenoids in wild Egyptian vultures caught at four regions in Spain as part of a study to determine the causes of variation among the sites in carotenoid availability. Their data (altered slightly for randomization and preliminary checks) is summarized in the table below. Use a one way ANOVA hypothesis at a [$LOS]%  LOS with preliminary checks to determine if the mean serum pigment ([`\mu g/ml`]) of the Egyptian vulture is significantly different for the four selected regions in Spain.


* Spaniards have nicknamed the Egyptian vulture [`mo\tilde n iguero`] which politely translates to "dung eater".

  

  

  

*Source: Whitlock and Shluter, "The  Analysis of  Biological Data", page 490.  

*image source from http://www.sdzsafaripark.org/wildlife/egyptian-vulture: [@ htmlLink( "http://www.sdzsafaripark.org/wildlife/egyptian-vulture","Egyptian vulture" ) @]***



[@

DataTable(

[

[["Site ", headerrow => 1],"N","\\(\\bar x\\) plasma carotenoids $BR concentration (\\(\\mu g/ml\\))", "Standard $BR deviation",],

[["$jnn" ], "$jn", "$jx", "$js"],

], 

caption => " ",

midrules => 1,

align => "|p{0.3in}|p{0.3in}|p{1.8in}|p{0.8in}|",

);

@]***  

  


*25.3) Step 1a:  Preliminary Checks*  

* The data sets are collected from [$popup1->menu]* and random samples.

* With summarized data, we assume that all data sets [$popup2->menu]* a normality test by the Anderson-Darling normality test, as we are using mean values.  


*25.3)  Step 1b:*   Check for Homoscedastity (equal variances):  

  

[@

DataTable(

[

[["Because of unequal sample sizes we must first calculate a harmonic mean for the grouped sample size, \\(n^{\\prime}.\\) "]," ","\\(\\displaystyle{n^{\\prime} = \\frac{k}{\\frac{1}{n_1}+\\frac{1}{n_2}+...+\\frac{1}{n_k}}}\\) "],

], 

caption => " ",

midrules => 0,

align => "p{3.8in}p{0.3in}p{3in}",

);

@]***  

  


 [`n'`] = [_____]  Use at least second decimal accuracy  

 [`n'`] = [_____]  Rounded up to the next integer for f-table use.  

  

Establish the decision line for Hartley's Equal variance test. Recognize that this is NOT the decision line for the ANOVA test, rather it is the decision line for the preliminary check of equal variances, without which we can not proceed with the ANOVA test.  

For Hartley's test: df = (k, [`n'`]-1) = [`\Large{(}`] [____] [`\Large{,}`][____] [`\Large{)}`]

  

 [`\hspace{50pt}`] [$popup5->menu]* [`\hspace{120pt}`] [$popup6->menu]*  

[@ image( "DecisionLine2.png", width=>690, height=>25, tex_size=>700, extra_html_tags=>'alt="A decision for the hypothesis on equal variances." ' ) @]***  

[`\hspace{120pt} \Large{F_{critical} =}`] [____]


*25.3) Step 1c:*  The statistical conclusion for Hartley's F test is:  


At the [$popup7->menu]*  LOS we [$popup8->menu]*  the null hypothesis of  [``\large{H_o  }``], because:



[@

DataTable(

[

[" \\(\\large{F}\\)-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{10pt}\\)  \\(\\large{F_{sample}}\\) \\(\\hspace{2pt}\\) ".$popup9->menu." \\(\\hspace{2pt}\\) \\(\\large{F _{critical}}\\) $BR $BR ".$fsamh->ans_rule(5)." ".$popup99->menu. " ".$fcrth->ans_rule(5). " "],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

  

[@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{115pt}\\) \\(\\Large{p} \\hspace{2pt}\\) ".$popup19->menu."\\(\\hspace{2pt} \\Large{\\alpha}\\) $BR $BR ".$popupph->menu."".$popup29->menu."".$popup10->menu."" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

With the preliminary checks of independent and random samples, a normal distribution and equal variances, [$popup11->menu]* with a one-way ANOVA test.



*25.3)  Step 2:*   Declare the variables for this hypothesis test:  


[@

DataTable(

[

["$BBOLD Note! $EBOLD Because of the limitations in software most special characters cannot be included in a 'pop-up' answer format and yet they are needed for the hypothesis formation. The pop-up selections will be in the text-form for the special characters embedded within the pop-up answer. Use the table at the right as a guide if needed.","  ",[image( "musubi.png", width=>189, height=>198, tex_size=>700 )],[image( "muby4.png", width=>258, height=>266, tex_size=>700 ) ] ] 

  ], 

  caption => "English text equivalence for the Variable and Hypothesis Options: ",

  midrules=>0, 

  align => "p{2.5in} p{0.1in} p{2in}p{2.5in}"

);

@]***  

  

  

*25.3)  Step 2:*   Declare the variables for this hypothesis test:  

  

[$popup3->menu]* = The [$popup4->menu]* plasma concentration of carotenoids in ([`\mu g/ml`]) for a wild Egyptian vulture from the [`i^{th}`] region in Spain.  


.  



*25.3)  Step 3)*  Choose the correct hypothesis statement to test the claim that the mean plasma concentration of carotenoids in ([`\mu g/ml`]) for a wild Egyptian vulture varies by region. Test the hypothesis at a [$LOS]%  LOS.  


  

[``\Large{H_o:}``] [$popup30->menu]*  

  

[``\Large{H_a:}``] [$popup31->menu]* 

  

[``\Large{\alpha =}``] [$poplos->menu]*


 

*25.3)  Step 4)*  Complete the partially filled ANOVA table as an aid in forming the  conclusion for the ANOVA hypothesis.  

  

[@  

DataTable(

[

[["Source ", headerrow => 1],"Sum of Squares $BR (SS)", "Degrees of $BR  freedom: df","Mean Squares $BR (MS)","F-sample"],

[["Between $BR Groups"], "SSB = $ssb",  "\\(df_b\\) =".$dfb->ans_rule(1)."", "MSB =".$msb->ans_rule(4)."", "\\(F_{Sample}\\) =".$fsam->ans_rule(4).""],

[["Within $BR Groups"], "SSW = $ssw", "\\(df_w\\) =".$dfw->ans_rule(1)."", "MSW =".$msw->ans_rule(4)."", "$BBOLD Bracketed p-value: $EBOLD"],

[["Total"], "SST =".$sst->ans_rule(4)."", "\\(df_t\\) =".$dft->ans_rule(1)."", "", " ".$pop21->menu.""],

], 

caption => "ANOVA TABLE ",

midrules => 1,

align => "|p{0.6in}|p{1.3in}|p{1.1in}||p{1.4in}|p{2in}|",

);

@]***  

  

  

*25.3),  Step 5)*  Write a statistical conclusion for the ANOVA hypothesis.  

  

  

At the [$popup40->menu]*  LOS we [$popup41->menu]*  the null hypothesis of  [``\large{H_o  }``], because:  



[@

DataTable(

[

[" df and \\(\\large{F}\\) $BR Notation $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{2pt}\\) \\(df = (df_B , df_W\\)) = \\(\\large{(}\\) ".$dfb->ans_rule(1)."\\(\\large{,}\\)".$dfw->ans_rule(1)."\\(\\large{)}\\) $BR $BR \\(\\hspace{11pt}\\) \\(\\large{F_{sample}}\\) \\(\\hspace{1pt}\\) ".$popup33->menu." \\(\\hspace{1pt}\\) \\(\\large{F_{critical}}\\)   $BR $BR ".$fsam->ans_rule(5)." ".$popup34->menu."".$fcrt->ans_rule(5)."" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

[@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{65pt}\\) \\(\\Large{p} \\hspace{2pt}\\) ".$popup44->menu."\\(\\hspace{2pt} \\Large{\\alpha}\\) $BR $BR \\(\\Large{p} = \\hspace{2pt}\\)".$popup45->menu."".$popup46->menu."".$popup47->menu."" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

*25.3),  Step 6)*   Write an English sentence conclusion.  

  

The evidence supports the case that mean plasma carotenoid concentration in [`\mu g/ml`] of Egyptian vultures [$popup48->menu]* according to region.

  

 

END_PGML


#Adapted weighted answers values:  


## Problems 25.3 ##


##Preliminary checks:


WEIGHTED_ANS( ($popup1)->cmp, 1 );

WEIGHTED_ANS( ($popup2)->cmp, 1 );


## Check for Equal Variances: 


WEIGHTED_ANS( ($nprime)->cmp, 5 );

WEIGHTED_ANS( ($npc)->cmp, 1 );


WEIGHTED_ANS( ($dfhn)->cmp, 2 );

WEIGHTED_ANS( ($dfhd)->cmp, 2 );

WEIGHTED_ANS( ($popup5)->cmp, 1 );

WEIGHTED_ANS( ($popup6)->cmp, 1 );

WEIGHTED_ANS( $fcrth->cmp() ->withPostFilter(AnswerHints(

$fcrth => "Yes!",

$fcrtw1 => "Wrong F-max Table, and both df are wrong: dfn = number of treatments, k, you used df = k - 1. And dfd = n' -1, but you summed data and subtracted the number of groups. You forgot the harmonic mean.",

$fcrtw2 => "Wrong F-max Table, and both df are wrong: dfn = number of treatments, k, you used df = k - 1. And dfd = n' -1, but you summed data and subtracted the number of groups. You forgot the harmonic mean. Also you are using the wrong alpha value.",

$fcrtw3 => "Wrong F-max Table. Your df is wrong: dfn = number of treatments, k, but you used df = k - 1.",

$fcrtw3 => "Wrong F-max Table. Your df is wrong: dfn = number of treatments, k, but you used df = k - 1. Also you are using the wrong alpha value.",

$fcrtw5 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. And your df are wrong: dfn = number of treatments, k, while you used df = k - 1.",

$fcrtw6 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. And your df are wrong: dfn = number of treatments, k, while you used df = k - 1. Also you have the wrong alpha value. Get it together!",

$fcrtw7 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table.",

$fcrtw8 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. And you are using the wrong alpha value.",

$fcrtw9 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also both df values are wrong and you did not use the harmonice mean. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw10 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also both your df values are wrong. You did not use the harmonic mean, n'-1 to find it. And your alpha value is wrong. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw11 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also your 2nd df value is wrong. You summed up data point rather than use the harmonic mean, n'-1 to find it. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw12 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also your 2nd df value is wrong. You summed up data point rather than use the harmonic mean, n'-1 to find it. And your alpha value is wrong. Try checking out the example problem in Lecture Week 12 day 3.",

)),3 );

WEIGHTED_ANS( ($popup7)->cmp, 1 );

WEIGHTED_ANS( ($popup8)->cmp, 1 );

WEIGHTED_ANS( ($popup9)->cmp, 1 );

WEIGHTED_ANS( ($fsamh)->cmp, 7 );

WEIGHTED_ANS( ($popup99)->cmp, 1 );

WEIGHTED_ANS( ($fcrth)->cmp, 5 );

WEIGHTED_ANS( ($popup19)->cmp, 1 );

WEIGHTED_ANS( ($popupph)->cmp, 4 );

WEIGHTED_ANS( ($popup29)->cmp, 1 );

WEIGHTED_ANS( ($popup10)->cmp, 2 );

WEIGHTED_ANS( ($popup11)->cmp, 1 );

## Declare Variables:


WEIGHTED_ANS( ($popup3)->cmp, 2 );

WEIGHTED_ANS( ($popup4)->cmp, 2 );


##Declare Hypothesis and LOS:


WEIGHTED_ANS( ($popup30)->cmp, 2 );

WEIGHTED_ANS( ($popup31)->cmp, 2 );


WEIGHTED_ANS( ($poplos)->cmp, 2 );


### ANOVA Table Entries: 

#WEIGHTED_ANS( ($ssb)->cmp, 2 );

#WEIGHTED_ANS( ($ssw)->cmp, 2 );



WEIGHTED_ANS( ($dfb)->cmp, 2 );

WEIGHTED_ANS( ($msb)->cmp, 3 );

WEIGHTED_ANS( ($fsam)->cmp, 4 );


WEIGHTED_ANS( ($dfw)->cmp, 3 );

WEIGHTED_ANS( ($msw)->cmp, 3 );

WEIGHTED_ANS( ($sst)->cmp, 2 );


WEIGHTED_ANS( ($dft)->cmp, 1 );


WEIGHTED_ANS( ($pop21)->cmp, 2 );



##### ANOVA Statistical Conclusion:  Step 5


WEIGHTED_ANS( ($popup40)->cmp, 2 );

WEIGHTED_ANS( ($popup41)->cmp, 2 );

WEIGHTED_ANS( ($dfb)->cmp, 2 );

WEIGHTED_ANS( ($dfw)->cmp, 2 );

WEIGHTED_ANS( ($popup33)->cmp, 1 );

WEIGHTED_ANS( ($fsam)->cmp, 3 );

WEIGHTED_ANS( ($popup34)->cmp, 1 );

WEIGHTED_ANS( $fcrt->cmp() ->withPostFilter(AnswerHints(

$fcrt => "Yes!",

$fin => "No, We should never round a df up to infinity",

$fcrtw11 => "Wrong Table! You are using the ANOVA F-critical table (yes) but your first df value is wrong. You need to subtract one from the number of groups (k-1) to find it. Also your alpha is possibly wrong. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw12 => "Wrong Table! You are using the ANOVA F-critical table but your first df value is wrong. You need to subtract one from the number of groups (k-1) to find it. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrth => "Wrong Table! That is the F-max critical value used for the equal variance test. You should be using the ANOVA F-critical table but your df value is wrong. You need to subtract one from the number of groups (k-1) to find it. Try checking out the example problem in Lecture Week 12 day 3. Also your alpha is likely wrong.",

$fcrtw1 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs. Also you are using the wrong alpha value.",

$fcrtw2 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs.",

$fcrtw3 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs. Also your 2nd df and alpha values are wrong.",

$fcrtw4 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs. Also your 2nd df value is wrong.",

$fcrtw5 => "Wrong 2nd df and possibly alpha! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

$fcrtw6 => "Wrong 2nd df! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

$fcrtw7 => "Both df values and possibly alpha are wrong! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

$fcrtw8 => "Both df values are wrong! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

)),4 );


WEIGHTED_ANS( ($popup44)->cmp, 1 );

WEIGHTED_ANS( ($popup45)->cmp, 3 );

WEIGHTED_ANS( ($popup46)->cmp, 1 );

WEIGHTED_ANS( ($popup47)->cmp, 1 );

WEIGHTED_ANS( ($popup48)->cmp, 1 );


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





BEGIN_PGML_SOLUTION



    *25.2) Step 1a:  Preliminary Checks*  

    * The data sets are collected from [$popup1] and random samples.  

    * With summarized data, we assume that all data sets [$popup2] a normality test by the Anderson-Darling normality test, as we are using mean values.  


    *25.2)  Step 1b:*   Check for Homoscedastity (equal variances):  

    

    [@

DataTable(

[

[["Site ", headerrow => 1],"N","\\(\\bar x\\) plasma carotenoids $BR concentration (\\(\\mu g/ml\\))", "Standard $BR deviation",],

[["$jnn" ], "$jn", "$jx", "$js"],

], 

caption => " ",

midrules => 1,

align => "|p{0.3in}|p{0.3in}|p{1.8in}|p{0.8in}|",

);

@]***  

    

    

    [@

DataTable(

[

[["Because of unequal sample sizes we must first calculate a harmonic mean for the grouped sample size, \\(n^{\\prime}.\\) $BR $BR Then \\(\\quad \\displaystyle{n^{\\prime} = \\frac{k}{\\frac{1}{n_1}+\\frac{1}{n_2}+...+\\frac{1}{n_k}} }\\) $BR $BR \\(\\displaystyle{n^{\\prime} = \\frac{4}{\\frac{1}{$nr[0]}+\\frac{1}{$nr[1]}+\\frac{1}{$nr[2]} +\\frac{1}{$nr[3]}}}\\) $BR $BR \\( n^{\\prime} = $nprime \\) $BR $BR The degrees of freedom for the equal variance test is \\( df = n^{\\prime} \\text{  (rounded up) } -1 \\) $BR $BR  \\(df = $npc - 1 = $npf\\) $BR $BR Now we can find the F-critical value for Hartley's F-max test for Equal variances by referencing the F-max table with 4 treatments: (at the right) $BR $BR With \\(k = 4 \\) groups (treatments) and \\(df = $npf \\)  and the standard LOS of 5% we find the \\(F_{critical} = F_{4, $npf} = $fcrth \\) $BR $BR Next we calculate the F-sample value for the F-max test: $BR $BR

\\(F_{sample} = \\frac{(sd_{max})^2}{(sd_{min})^2} = \\frac{($mxsd)^2}{($mnsd)^2} = $fsamh \\)"], " ",image( "Fmax4.png", width=>313, height=>632, tex_size=>700, extra_html_tags=>'alt="An image of the F-max table for F-critical values for degrees of freedom of 4." '  ) ],

], 

caption => " ",

midrules => 0,

align => "p{3.8in}p{0.3in}p{2.3in}",

);

@]***  

    

    

    

        Establish the decision line for Hartley's Equal variance test. Recognize that this is NOT the decision line for the ANOVA test, rather it is the decision line for the preliminary check of equal variances, without which we can not proceed with the ANOVA test.  

For Hartley's test: df = (k, [`n'`]-1) = [``\large{(4, [$npf] )}``]  

  

 [`\hspace{50pt}`] *Do Not Reject Ho* [`\hspace{120pt}`] *Reject Ho*  

[@ image( "DecisionLine2.png", width=>690, height=>25, tex_size=>700, extra_html_tags=>'alt="A decision for the hypothesis on equal variances." ' )@]***    

[``\hspace{160pt} \large{F_{4, [$npf] } = [$fcrth]}``] 

    

    

    *25.3) Step 1c:*  The statistical conclusion for Hartley's F test is:  


    At the [$popup7]  LOS we [$popup8]  the null hypothesis of  [``\large{H_o  }``], because:  

    

    

    [@

DataTable(

[

[" \\(\\large{F}\\)-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{10pt} \\large{F_{sample}} \\hspace{2pt} $popup9 \\hspace{2pt} \\large{F _{critical}}\\) $BR $BR \\( \\hspace{10pt} $fsamh $popup99 $fcrth \\) "],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    

    [@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{30pt}\\large{p} \\hspace{2pt} $popup19 \\hspace{2pt} \\large{\\alpha}\\) $BR $BR \\( $popupph  $popup29 $popup10 \\)" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    With the preliminary checks of independent and random samples, a normal distribution and equal variances, [$popup11] with a one-way ANOVA test.



    *25.3)  Step 2:*   Declare the variables for this hypothesis test:  

    

    

     [``\mu_i``] = The *mean* plasma concentration of carotenoids in ([`\mu g/ml`]) for a wild Egyptian vulture from the [`i^{th}`] region in Spain.  

     

     

     *25.3)  Step 3)*  Choose the correct hypothesis statement to test the claim that the mean emission rate in (ng/hour) for a potato plant varies depending upon the type of attacking insect. Test the hypothesis at a [$LOS]%  LOS.  


  

    [``\large{H_o \hspace{-3pt}: \hspace{3pt} \mu_1 = \mu_2 = \mu_3 = \mu_4 }``]  

  

    [``\large{H_a \hspace{-3pt}: \hspace{3pt} }``]  *At least one mean is not equal*  

  

    [``\large{\alpha = [$poplos]}``]  

    

    

        *25.3)  Step 4)*  Complete the partially filled ANOVA table as an aid in forming the  conclusion for the ANOVA hypothesis.  

  

    [@

DataTable(

[

[["Source ", headerrow => 1],"Sum of Squares $BR (SS)", "Degrees of $BR  freedom: df","Mean Squares $BR (MS)","F-sample"],

[["Between $BR Groups"], "SSB = $ssb",  "\\(df_b\\) = $dfb ", "MSB = $msb ", "\\(F_{Sample}\\) = $fsam "],

[["Within $BR Groups"], "SSW = $ssw" , "\\(df_w\\) = $dfw ", "MSW = $msw" , "$BBOLD Bracketed p-value: $EBOLD"],

[["Total"], "SST = $sst ", "\\(df_t\\) = $dft ", "", "  $pop21 "],

], 

caption => "ANOVA TABLE ",

midrules => 1,

align => "|p{0.6in}|p{1.3in}|p{1.1in}||p{1.4in}|p{2in}|",

);

@]***  

  

    

    

    *25.3),  Step 5)*  Write a statistical conclusion for the ANOVA hypothesis.

    

    

    At the [$popup40]  LOS we [$popup41]  the null hypothesis of  [``\large{H_o  }``], because:  

    

    

    [@

DataTable(

[

[" df and \\(\\large{F}\\) $BR Notation $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{2pt} df = (df_B , df_W ) =  ( $dfb , \\,  $dfw ) \\) $BR $BR \\( \\large{F_{sample}}  $popup33 \\large{F_{critical}}\\)   $BR $BR \\( $fsam $popup34 $fcrt \\)" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    

    [@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{20pt} \\large{p} \\hspace{2pt} $popup44 \\hspace{2pt} \\large{\\alpha}\\) $BR $BR \\(\\hspace{2pt} $popup45 $popup46 $popup47 \\)" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    *25.3),  Step 6)*   Write an English sentence conclusion.  

  

  

    The evidence supports the case that mean plasma carotenoid concentration in [`\mu g/ml`] of Egyptian vultures [$popup48] according to region.

    

    

    

END_PGML_SOLUTION




  


ENDDOCUMENT();##DESCRIPTION

## ANOVA, SNK test

##ENDDESCRIPTION


## KEYWORDS('anova', 'snk test')


## DBsubject('Statisitics')

## DBchapter('confidence intervals')

## DBsection('Real Numbers')

## Date('11/7/2016')

## Author('Tim Payer')

# DESCRIPTION  ANOVA, SNK test

# Use correct notation.

# WeBWorK problem written by TimPayer <tsp1@humboldt.edu>

# ENDDESCRIPTION


## DBsubject(Probability)

## DBchapter(Random variables)

## DBsection(Expectation)

## Institution(Humboldt State University)

## Author(Tim Payer)

## KEYWORDS(probability, translate, notation)

DOCUMENT();


loadMacros(

"PGstandard.pl",

"PGunion.pl",

"PGnumericalmacros.pl",

"PGstatisticsmacros.pl",

"MathObjects.pl",

"parserPopUp.pl",

"PGML.pl",

"unionTables.pl",

"niceTables.pl",

"PGcourse.pl",

"PGchoicemacros.pl",

  "answerHints.pl",

"weightedGrader.pl"

);


install_weighted_grader();


TEXT(beginproblem()); 


#install_problem_grader(~~&std_problem_grader);

$showPartialCorrectAnswers = 1;


Context("Numeric");

Context()->flags->set(

  tolerance => 0.01,

  tolType => "absolute",

);


## Note that the wide tolerance was preventing a correct bracketing of the 

## p-value for $fsamh. knocking the tolerance back down redirects the issue

## toward generating a correct SSW value and direct calculation may be needed..

############ Start Problem 25.1  ##################


### Summarized Data table values:

@nn =();

$nn[0] = Compute("1");

$nn[1] = Compute("2");

$nn[2] = Compute("3");

$nn[3] = Compute("4");


### sample size per group:

@nr =();

$nr[0] = random(19,25,1);

$nr[1] = random(68,77,1);

$nr[2] = random(70,82,1);

$nr[3] = random(9,13,1); ## widen from (9, 13) which was producing a tiny sd?


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

## This next block generates raw data for each group

## and then finds the summarizing values of the mean and sd.

## Start with an empty array and subtract one to account for 

## arrays that start at zero to mesh with sample size:

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


## Site 1

@cont = ();  

foreach my $i ( 0..$nr[0] - 1 ) {

    $cont[$i] = random(4.6, 12.6,0.01);   # diff = 8

}

$contm = stats_mean(@cont);

$conts = stats_sd(@cont);

$control = join(", ",@cont);



## Site 2

@flea = ();

foreach my $i ( 0..$nr[1] - 1 ) {

     $flea[$i] = random(2.51,11.51,0.01); # diff = 9

}

$fleam = stats_mean(@flea);

$fleas = stats_sd(@flea);

$fleab = join(", ",@flea);


## Site 3

@copb = ();

foreach my $i ( 0..$nr[2] - 1 ) {

     $copb[$i] = random(3.10,13.1,0.01);  # diff = 10

}

$copbm = stats_mean(@copb);

$copbs = stats_sd(@copb);

$copbb = join(", ",@copb);


## Site 4

@ww = ();

foreach my $i ( 0..$nr[3] - 1 ) {

     $ww[$i] = random(9.50, 19.5,0.01);  # diff = 10

}

###  I need to have a check in the loops above to prevent small sds

###  from occurring as they will tend cause Hartley test to fail when

###  other sds are large. That is,

###  the F-sample will be too large relative to the F-critical.

###  Then the check must be for a wide enough range to anticipate the

###  comparitive sd values for the F-max test?

$wwm = stats_mean(@ww);

$wws = stats_sd(@ww);

$wwb = join(", ",@ww);



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


@sr =();

$sr[0] = sprintf("%0.1f",$conts);

$sr[1] = sprintf("%0.1f",$fleas);

$sr[2] = sprintf("%0.1f",$copbs);

$sr[3] = sprintf("%0.1f",$wws);


####  Finding the largest and smallest sd for F-max test:

my $index = 0;

my $maxsd = $sr[ my $index ];

for ( 0 .. 3 )

{

    if ( $maxsd < $sr[$_] )

    {

        $index = $_;

        $maxsd = $sr[$_];

    }

}


$mxsd = $maxsd;



my $index = 0;

my $minsd = $sr[ my $index ];

for ( 0 .. 3 )

{

    if ( $minsd > $sr[$_] )

    {

        $index = $_;

        $minsd = $sr[$_];

    }

}


$mnsd = $minsd;


######  Rounding Sample means....

@xr =();

$xr[0] = sprintf("%0.1f",$contm);

$xr[1] = sprintf("%0.1f",$fleam);

$xr[2] = sprintf("%0.1f",$copbm);

$xr[3] = sprintf("%0.1f",$wwm);




$jnn = join("$BR ",@nn);

$jn = join("$BR ",@nr);

$jx = join("$BR ",@xr,);

$js = join("$BR ",@sr);


$trial = random(3, 9, 1);

## Preliminary Checks:  Step 1 ####


$popup1 = PopUp(

["Choose:", 'independent', 'dependent'], 'independent');


$popup2 = PopUp(

["Choose:", 'pass', 'fail'], 'pass');


## Preliminary Checks:  Step 1b, Equal variances ####


$nprime = Compute("4/(1/$nr[0]+1/$nr[1]+1/$nr[2]+1/$nr[3])");

$npff =floor($nprime);

$npf = Compute("$npff");

$npc = Compute("$npff+1");


$popup5 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Do Not Reject');


$popup6 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Reject');


$popup7 = PopUp(

["??", '40%','20%','10%', '5%','2.5%', '2%', '1%', '0.1%', '0.01%'], '5%');


$popup8 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Do Not Reject');



##### Older code for previous-pre-matrix attempts  ####

$dfhn =Compute("4");       ## Delete when replaced

$dfhd =Compute("$npf");    ## Delete when replaced

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


## Using a matrix to determine F-critical for Hartleys test, alpha = 0.05

##  Listing the F-Critical values for Hartley's with df = (4, 20:28)


$M1 = Matrix([2.46, 2.87, 3.28, 3.84, 4.29, 5.99], [2.41, 2.79, 3.18, 3.71, 4.13, 5.71], [2.36, 2.72, 3.09, 3.59, 3.99, 5.46], [2.31, 2.66, 3.01, 3.49, 3.86, 5.24], [2.27, 2.60, 2.94, 3.39, 3.74, 5.04], [2.23, 2.55, 2.87, 3.30, 3.64, 4.86], [2.19, 2.50, 2.81, 3.22, 3.54, 4.70], [2.16, 2.46, 2.75, 3.15, 3.45, 4.55], [2.13, 2.42, 2.70, 3.08, 3.37, 4.42]);


## F-sample for Hartleys: max/min variances based on max/min diff.

$fsamh = Compute("$maxsd**2/$minsd**2");  

$rw =$npf-19;  ## Letting dfw reset from rows 20-28 to rows 1-9

$fcrth = $M1->element($rw, 3);  ## Hartleys F-Critical for 5% 

##### If-then Conditional for bracketing p-value of Hartleys test.

if($fsamh < $M1->element($rw, 1)){

      $pp = "(p > 0.20)";

    } elsif(($M1->element($rw, 1) < $fsamh) && ($fsamh < $M1->element($rw, 2)) ) {

      $pp = "(0.10 < p < 0.20)";

    } elsif(($M1->element($rw, 2) < $fsamh) && ($fsamh < $M1->element($rw, 3)) ) {

      $pp = "(0.05 < p < 0.10)";

    } elsif(($M1->element($rw, 3) < $fsamh) && ($fsamh < $M1->element($rw, 4)) ) {

      $pp = "(0.02 < p < 0.05)";

    } elsif(($M1->element($rw, 4) < $fsamh) && ($fsamh < $M1->element($rw, 5)) ) {

      $pp = "(0.01 < p < 0.02)";

    } elsif(($M1->element($rw, 5) < $fsamh) && ($fsamh < $M1->element($rw, 6)) ) {

      $pp = "(0.001 < p < 0.01)";

    } else{

     $pp = "(p < 0.001)";

}




$popup9 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '<');


$popup99 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '<');



$popup19 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popupph = PopUp(

["which bracketed p-value?",

"(p > 0.40)", "(p > 0.20)","(0.20 < p < 0.40)","(0.10 < p < 0.20)", "(0.05 < p < 0.10)", "(0.025 < p < 0.05)", "(0.02 < p < 0.05)", "(0.01 < p < 0.025)","(0.01 < p < 0.02)",  "(0.005 < p < 0.01)",  "(0.001 < p < 0.01)", "(0.0001 < p < 0.001)", "(p < 0.01)", "(p < 0.001)", "(p < 0.0001)"], $pp );


####   this Should hold $pp as an answer above instead of "(p > 0.20)"  ??

$popup29 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popup10 = PopUp(

["alpha",  '0.20','0.10', '0.05', '0.02', '0.01', '0.001', '0.0001'], '0.05');


$popup11 = PopUp(

["??", 'all met, we can proceed', 'not met, we can not proceed', 'mostly met, we can proceed'], 'all met, we can proceed');


## IF needed and array sequence for Hartleys F test:

$fr = list_random(0, 1, 2, 3, 4, 5, 6);  ## permits random selections of a specified range.

@falfa = ( '0.20','0.10', '0.05','0.02', '0.01', '0.001', '0.0001');

@falfap = ( '20%','10%', '5%','2%', '1%', '0.1%', '0.01%');



### Declaration of Variables: Step 2  ####


$popup3 = PopUp(

["Choose:",   'x-bar-i', 'mu-i', 'x-tilde-i', 'eta-i'], 'mu-i');


$popup4 = PopUp(

["Choose:", 'mean', 'median','standard deviation of', 'proportion of'], 'mean');


### Declaration of Hypothesis: Step 3  ####


$popup30 = PopUp(

["??", 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'], 'D');


$popup31 = PopUp(

["??", 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'], 'C');


$r = list_random(0, 1, 2, 3, 4, 5, 6);  ## permits random selections of a specified range.

@alfa = ( '0.20','0.10', '0.05','0.02', '0.01', '0.001', '0.0001');

@alfap = ( '20%','10%', '5%','2%', '1%', '0.1%', '0.01%');

$alfp = "$alfap[$r]";


$LOS =Compute("100*$alfa[$r]");

$poplos = PopUp(

["alpha", '0.40', '0.20','0.10', '0.05','0.025', '0.02', '0.01', '0.001', '0.0001'], $alfa[$r]);


###  Calculate values for ANOVA Table: Step 4


$h1=0;

foreach my $i (0..3) {

   $sm1 =Compute("$h1 + $nr[$i]");   ## Summing all sample sizes

   $h1 = $sm1;

}


$h2=0;

foreach my $i (0..3) {

   $sm2 =Compute("$h2 + $nr[$i]*$xr[$i]");   ## Summing all n*xbars 

   $h2 = $sm2;

}


$gm2 =Compute("$sm2/$sm1");   ## the grand mean


$h3=0;

foreach my $i (0..3) {

   $sm3 =Compute("$h3 + $nr[$i]*($xr[$i]-$gm2)**2");   ## Summing to ssb 

   $h3 = $sm3;

}


$h4=0;

foreach my $i (0..3) {

   $sm4 =Compute("$h4 + ($nr[$i]-1)*($sr[$i])**2");   ## Summing to SSW

   $h4 = $sm4;

}


$ssb=Compute("$sm3");

#$ssw =Compute("$sm4");

$ssw2 =Compute("$sm4");

$ssw1 =sprintf("%0.1f",$ssw2);

#$ssw =Compute("$ssw1");

$ssw = Compute($ssw1)->with(

  tolType => 'relative',

  tolerance => .005,

);


#$sst = Compute("$ssb+$ssw");

$sst = Compute("$ssb+$ssw")->with(

  tolType => 'relative',

  tolerance => .001,

);

$dfb = Compute("3");

$dfw = Compute("$sm1-4");

$dft = Compute("$dfb+$dfw");

$msb = Compute("$ssb/$dfb");

#$msw = Compute("$ssw/$dfw");

$msw2 = Compute("$ssw/$dfw");

$msw1 = sprintf("%0.3f",$msw2);

$msw = Compute("$msw1");

#$fsam = Compute("$msb/$msw");

$fsam = Compute("$msb/$msw")-> with(

  tolType => 'absolute',

  tolerance => .05, ); ## Wider tolerance x5 to permit some round off errors...


### ### A 2x7 matrix to find f-critical and bracket -p for the ANOVA test.  ####


$M2 = Matrix([1.58, 2.14, 2.70, 3.43, 3.98, 5.86, 7.79], [1.57, 2.12, 2.67, 3.38, 3.92, 5.73, 7.57]);


if(($dfw >= 100) &&($dfw < 140)){

      $ra =1;

     @fcrit =('1.58','2.14', '2.70', '3.43', '3.98', '5.86', '7.79');

      } else{

      $ra =2;

     @fcrit =('1.57','2.12', '2.67', '3.38', '3.92', '5.73', '7.57');

}


@finf =('1.55','2.08', '2.60', '3.28', '3.78', '5.425', '7.04');

$fin = Compute("$finf[$r]");

$fcrt =Compute("$fcrit[$r]");



if($fsam < $M2->element($ra, 1)){

      $pa = "(p > 0.20)";

    } elsif(($M2->element($ra,1) < $fsam) && ($fsam < $M2->element($ra,2)) ) {

      $pa = "(0.10 < p < 0.20)";

    } elsif(($M2->element($ra,2) < $fsam) &&  ($fsam < $M2->element($ra,3)) ) {

      $pa = "(0.05 < p < 0.10)";

    } elsif(($M2->element($ra,3) < $fsam) &&  ($fsam < $M2->element($ra,4)) ) {

      $pa = "(0.02 < p < 0.05)";

    } elsif(($M2->element($ra,4) < $fsam) &&  ($fsam < $M2->element($ra,5)) ) {

      $pa = "(0.01 < p < 0.02)";

    } elsif(($M2->element($ra,5) < $fsam) &&  ($fsam < $M2->element($ra,6)) ) {

      $pa = "(0.001 < p < 0.01)";

     } elsif(($M2->element($ra,6) < $fsam) &&  ($fsam < $M2->element($ra,7)) ) {

      $pa = "(0.0001 < p < 0.001)";

     } else{

     $pa = "(p < 0.0001)";

}



$pop21 = PopUp(

["which bracketed p-value?",

"(p > 0.40)", "(p > 0.20)","(0.20 < p < 0.40)","(0.10 < p < 0.20)", "(0.05 < p < 0.10)", "(0.025 < p < 0.05)", "(0.02 < p < 0.05)", "(0.01 < p < 0.025)","(0.01 < p < 0.02)",  "(0.005 < p < 0.01)",  "(0.001 < p < 0.01)", "(0.0005 < p < 0.005)",  "(p < 0.001)", "(p < 0.0001)"], "(p < 0.0001)" );


##### But $pa should be used above when ready....

#### Write a Statistical conclusion to the ANOVA hypothesis.


$popup40 = PopUp(

["??", '40%','20%','10%', '5%','2.5%', '2%', '1%', '0.1%', '0.01%'], $alfp);


$popup41 = PopUp(

["Choose:", 'Reject', 'Do Not Reject'], 'Reject');


@fcrit =('1.57','2.12', '2.67', '3.38', '3.92', '5.73', '7.57');

@finf =('1.55','2.08', '2.60', '3.28', '3.78', '5.42', '7.04');

$fcrt =Compute("$fcrit[$r]");

$fin = Compute("$finf[$r]");


$popup33 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popup34 = PopUp(

["??", '<', '>', '=', '< or =', '> or ='], '>');


$popup44 = PopUp(

["??", '<', '>'], '<');


$popup45 = PopUp(

["which bracketed p-value?",

"(p > 0.40)", "(p > 0.20)","(0.20 < p < 0.40)","(0.10 < p < 0.20)", "(0.05 < p < 0.10)", "(0.025 < p < 0.05)", "(0.02 < p < 0.05)", "(0.01 < p < 0.025)","(0.01 < p < 0.02)",  "(0.005 < p < 0.01)",  "(0.001 < p < 0.01)", "(0.0005 < p < 0.005)",  "(p < 0.001)", "(p < 0.0001)"], "(p < 0.0001)" );


$popup46 = PopUp(

["??", '<', '>'], '<');


$popup47 = PopUp(

["alpha", '0.40', '0.20','0.10', '0.05','0.025', '0.02', '0.01', '0.001', '0.0001'], $alfa[$r] );


$popup48 = PopUp(

["Choose:", 'varies', 'does not vary'], 'varies');



####  Begin Problem...


#### M3 is a 30 x 7 Matrix of wrong critical values that students are likely

#### to submit as answers for Hartley's F-max Critical Value. 

#### Flagging these entries will prompt the 

#### student of the type of error made. Note that the F-max table will have

#### duplicate values on the last row as it has one less column than 

#### the ANOVA f-critical values and this is the "mesh" for this case.

####  fcrtw1: Row 1 = used df(3,120), should be df =4 for F-max critical  

####  Wrong F-max: df = (3, 20:28) at rows 2-10,  

####  Wrong F-Critical df = (3, 20:28) at rows 11-19, 

####  Wrong F-Critical (4, 20:28) at rows 20-28, 

####  Wrong F-Critical  Row 29 = df(3,140), Row 30 = df(4,140)


$M3 = Matrix([1.37, 1.46, 1.54, 1.64, 1.71, 1.94, 1.94], [1.63, 1.88, 2.13, 2.46, 2.72, 3.65, 3.65], [2.19, 2.57, 2.95, 3.48, 3.90, 5.50, 5.50], [2.15, 2.51, 2.87, 3.37, 3.76, 5.25, 5.25],[2.11, 2.45, 2.80, 3.27, 3.64, 5.03, 5.03], [2.07, 2.40, 2.73, 3.18, 3.53, 4.84, 4.84], [2.04, 2.35, 2.67, 3.10, 3.43, 4.66, 4.66], [2.01, 2.31, 2.61, 3.02, 3.34, 4.51, 4.51], [1.98, 2.27, 2.56, 2.95, 3.26, 4.36, 4.36], [1.95, 2.24, 2.52, 2.89, 3.18, 4.23, 4.23], [1.93, 2.20, 2.47, 2.83, 3.11, 4.12, 4.12], [1.70, 2.38, 3.10, 4.11, 4.94, 8.10, 12.05], [1.69, 2.36, 3.07, 4.07, 4.87, 7.94, 11.73], [1.68, 2.35, 3.05, 4.03, 4.82, 7.80, 11.44], [1.68, 2.34, 3.03, 3.99, 4.76, 7.67, 11.19], [1.67, 2.33, 3.01, 3.96, 4.72, 7.55, 10.96], [1.66, 2.32, 2.99, 3.93, 4.68, 7.45, 10.76], [1.66, 2.31, 2.98, 3.90, 4.64, 7.36, 10.58], [1.65, 2.30, 2.96, 3.87, 4.60, 7.27, 10.41], [1.65, 2.29, 2.95, 3.85, 4.57, 7.19, 10.26], [1.65, 2.25, 2.87, 3.73, 4.43, 7.10, 10.41], [1.65, 2.23, 2.84, 3.69, 4.37, 6.95, 10.12], [1.64, 2.22, 2.82, 3.65, 4.31, 6.81, 9.86], [1.63, 2.21, 2.80, 3.61, 4.26, 6.70, 9.63], [1.63, 2.19, 2.78, 3.58, 4.22, 6.59, 9.42], [1.62, 2.18, 2.76, 3.55, 4.18, 6.49, 9.24], [1.62, 2.17, 2.74, 3.52, 4.14, 6.41, 9.07],[1.61, 2.17, 2.73, 3.50, 4.11, 6.33, 8.92], [1.61, 2.16, 2.71, 3.47, 4.07, 6.25, 8.79], [1.57, 2.12, 2.67, 3.38, 3.92, 5.73, 7.57], [1.52, 1.99, 2.44, 3.02, 3.46, 4.90, 6.35]);


$fcrtw1 = $M3->element(1, 3);  ##F-max: k=3, dfw = 120,  alpha = 5%

$fcrtw2 = $M3->element(1, $rw-1); ##F-max: k=3, dfw = 120,  alpha = a%

$fcrtw3 = $M3->element($rw+2, 3); ##F-max: k=3, dfw = good,  alpha = 5%

$fcrtw4 = $M3->element($rw+2, $rw-1);  ##F-max: k=3, dfw = good,  alpha = a%

$fcrtw5 = $M3->element($rw+11, 3); ##F-Crit: k=3, dfw = good,  alpha = 5%

$fcrtw6 = $M3->element($rw+11, $rw-1);  ##F-Crit: k=3, dfw = good,  alpha = a%

$fcrtw7 = $M3->element($rw+20, 3); ##F-Crit: k=4, dfw = good,  alpha = 5%

$fcrtw8 = $M3->element($rw+20, $rw-1);  ##F-Crit: k=4, dfw = good,  alpha = a%

$fcrtw9 = $M3->element(30, 3); ##F-Crit: k=3, dfw = 140,  alpha = 5%

$fcrtw10 = $M3->element(30, $rw-1);  ##F-Crit: k=3, dfw = 140,  alpha = a%

$fcrtw11 = $M3->element(31, 3); ##F-Crit: k=4, dfw = 140,  alpha = 5%

$fcrtw12 = $M3->element(31, $rw-1);  ##F-Crit: k=4, dfw = 140,  alpha = a%


BEGIN_PGML 

   *Drawn from Lecture Notes: Week 11 Day 2, Week 12 Day 2, and Week 12 Day 3.*  

  

[@

DataTable(

[

["$BBOLD 25.3)  $EBOLD The bright yellow head of the adult male Egyptian vulture requires carotenoid pigments. The brighter the yellow pigment, the more likely that the male will attract a mate. These pigments can not be synthesized by the vultures, so they must be obtained through their diet. Unfortunately, carotenoids are scarce in rotten flesh and bones, but they are readily available in the dung of ungulates. Which is why Egyptian vultures are frequently seen eating the droppings of cows, goats, and sheep in Spain, where they have been studied.","  ",[" An Egyptian Vulture, $BITALIC Neophron percnopterus $EITALIC".$BR.image( "Yellowhead.png", width=>743, height=>382, tex_size=>700 ).$BR."image by San Diego Zoo Safari Park" ]]], 

  caption => "Does the Carotenoid Pigment of the Egyptian Vulture Vary by Region?",

  midrules=>0, 

  align => "p{3.5in} p{0.1in} p{4.2in}"

);

@]***  

  

  


Ungulates are common in some areas but not in others. Could the variation in yellow pigment coloring of the Egyptian vulture be due to a variation in the availability in ungulate dung? Negro et al. (2002) measured plasma carotenoids in wild Egyptian vultures caught at four regions in Spain as part of a study to determine the causes of variation among the sites in carotenoid availability. Their data (altered slightly for randomization and preliminary checks) is summarized in the table below. Use a one way ANOVA hypothesis at a [$LOS]%  LOS with preliminary checks to determine if the mean serum pigment ([`\mu g/ml`]) of the Egyptian vulture is significantly different for the four selected regions in Spain.


* Spaniards have nicknamed the Egyptian vulture [`mo\tilde n iguero`] which politely translates to "dung eater".

  

  

  

*Source: Whitlock and Shluter, "The  Analysis of  Biological Data", page 490.  

*image source from http://www.sdzsafaripark.org/wildlife/egyptian-vulture: [@ htmlLink( "http://www.sdzsafaripark.org/wildlife/egyptian-vulture","Egyptian vulture" ) @]***



[@

DataTable(

[

[["Site ", headerrow => 1],"N","\\(\\bar x\\) plasma carotenoids $BR concentration (\\(\\mu g/ml\\))", "Standard $BR deviation",],

[["$jnn" ], "$jn", "$jx", "$js"],

], 

caption => " ",

midrules => 1,

align => "|p{0.3in}|p{0.3in}|p{1.8in}|p{0.8in}|",

);

@]***  

  


*25.3) Step 1a:  Preliminary Checks*  

* The data sets are collected from [$popup1->menu]* and random samples.

* With summarized data, we assume that all data sets [$popup2->menu]* a normality test by the Anderson-Darling normality test, as we are using mean values.  


*25.3)  Step 1b:*   Check for Homoscedastity (equal variances):  

  

[@

DataTable(

[

[["Because of unequal sample sizes we must first calculate a harmonic mean for the grouped sample size, \\(n^{\\prime}.\\) "]," ","\\(\\displaystyle{n^{\\prime} = \\frac{k}{\\frac{1}{n_1}+\\frac{1}{n_2}+...+\\frac{1}{n_k}}}\\) "],

], 

caption => " ",

midrules => 0,

align => "p{3.8in}p{0.3in}p{3in}",

);

@]***  

  


 [`n'`] = [_____]  Use at least second decimal accuracy  

 [`n'`] = [_____]  Rounded up to the next integer for f-table use.  

  

Establish the decision line for Hartley's Equal variance test. Recognize that this is NOT the decision line for the ANOVA test, rather it is the decision line for the preliminary check of equal variances, without which we can not proceed with the ANOVA test.  

For Hartley's test: df = (k, [`n'`]-1) = [`\Large{(}`] [____] [`\Large{,}`][____] [`\Large{)}`]

  

 [`\hspace{50pt}`] [$popup5->menu]* [`\hspace{120pt}`] [$popup6->menu]*  

[@ image( "DecisionLine2.png", width=>690, height=>25, tex_size=>700, extra_html_tags=>'alt="A decision for the hypothesis on equal variances." ' ) @]***  

[`\hspace{120pt} \Large{F_{critical} =}`] [____]


*25.3) Step 1c:*  The statistical conclusion for Hartley's F test is:  


At the [$popup7->menu]*  LOS we [$popup8->menu]*  the null hypothesis of  [``\large{H_o  }``], because:



[@

DataTable(

[

[" \\(\\large{F}\\)-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{10pt}\\)  \\(\\large{F_{sample}}\\) \\(\\hspace{2pt}\\) ".$popup9->menu." \\(\\hspace{2pt}\\) \\(\\large{F _{critical}}\\) $BR $BR ".$fsamh->ans_rule(5)." ".$popup99->menu. " ".$fcrth->ans_rule(5). " "],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

  

[@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{115pt}\\) \\(\\Large{p} \\hspace{2pt}\\) ".$popup19->menu."\\(\\hspace{2pt} \\Large{\\alpha}\\) $BR $BR ".$popupph->menu."".$popup29->menu."".$popup10->menu."" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

With the preliminary checks of independent and random samples, a normal distribution and equal variances, [$popup11->menu]* with a one-way ANOVA test.



*25.3)  Step 2:*   Declare the variables for this hypothesis test:  


[@

DataTable(

[

["$BBOLD Note! $EBOLD Because of the limitations in software most special characters cannot be included in a 'pop-up' answer format and yet they are needed for the hypothesis formation. The pop-up selections will be in the text-form for the special characters embedded within the pop-up answer. Use the table at the right as a guide if needed.","  ",[image( "musubi.png", width=>189, height=>198, tex_size=>700 )],[image( "muby4.png", width=>258, height=>266, tex_size=>700 ) ] ] 

  ], 

  caption => "English text equivalence for the Variable and Hypothesis Options: ",

  midrules=>0, 

  align => "p{2.5in} p{0.1in} p{2in}p{2.5in}"

);

@]***  

  

  

*25.3)  Step 2:*   Declare the variables for this hypothesis test:  

  

[$popup3->menu]* = The [$popup4->menu]* plasma concentration of carotenoids in ([`\mu g/ml`]) for a wild Egyptian vulture from the [`i^{th}`] region in Spain.  


.  



*25.3)  Step 3)*  Choose the correct hypothesis statement to test the claim that the mean plasma concentration of carotenoids in ([`\mu g/ml`]) for a wild Egyptian vulture varies by region. Test the hypothesis at a [$LOS]%  LOS.  


  

[``\Large{H_o:}``] [$popup30->menu]*  

  

[``\Large{H_a:}``] [$popup31->menu]* 

  

[``\Large{\alpha =}``] [$poplos->menu]*


 

*25.3)  Step 4)*  Complete the partially filled ANOVA table as an aid in forming the  conclusion for the ANOVA hypothesis.  

  

[@  

DataTable(

[

[["Source ", headerrow => 1],"Sum of Squares $BR (SS)", "Degrees of $BR  freedom: df","Mean Squares $BR (MS)","F-sample"],

[["Between $BR Groups"], "SSB = $ssb",  "\\(df_b\\) =".$dfb->ans_rule(1)."", "MSB =".$msb->ans_rule(4)."", "\\(F_{Sample}\\) =".$fsam->ans_rule(4).""],

[["Within $BR Groups"], "SSW = $ssw", "\\(df_w\\) =".$dfw->ans_rule(1)."", "MSW =".$msw->ans_rule(4)."", "$BBOLD Bracketed p-value: $EBOLD"],

[["Total"], "SST =".$sst->ans_rule(4)."", "\\(df_t\\) =".$dft->ans_rule(1)."", "", " ".$pop21->menu.""],

], 

caption => "ANOVA TABLE ",

midrules => 1,

align => "|p{0.6in}|p{1.3in}|p{1.1in}||p{1.4in}|p{2in}|",

);

@]***  

  

  

*25.3),  Step 5)*  Write a statistical conclusion for the ANOVA hypothesis.  

  

  

At the [$popup40->menu]*  LOS we [$popup41->menu]*  the null hypothesis of  [``\large{H_o  }``], because:  



[@

DataTable(

[

[" df and \\(\\large{F}\\) $BR Notation $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{2pt}\\) \\(df = (df_B , df_W\\)) = \\(\\large{(}\\) ".$dfb->ans_rule(1)."\\(\\large{,}\\)".$dfw->ans_rule(1)."\\(\\large{)}\\) $BR $BR \\(\\hspace{11pt}\\) \\(\\large{F_{sample}}\\) \\(\\hspace{1pt}\\) ".$popup33->menu." \\(\\hspace{1pt}\\) \\(\\large{F_{critical}}\\)   $BR $BR ".$fsam->ans_rule(5)." ".$popup34->menu."".$fcrt->ans_rule(5)."" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

[@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{65pt}\\) \\(\\Large{p} \\hspace{2pt}\\) ".$popup44->menu."\\(\\hspace{2pt} \\Large{\\alpha}\\) $BR $BR \\(\\Large{p} = \\hspace{2pt}\\)".$popup45->menu."".$popup46->menu."".$popup47->menu."" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

*25.3),  Step 6)*   Write an English sentence conclusion.  

  

The evidence supports the case that mean plasma carotenoid concentration in [`\mu g/ml`] of Egyptian vultures [$popup48->menu]* according to region.

  

 

END_PGML


#Adapted weighted answers values:  


## Problems 25.3 ##


##Preliminary checks:


WEIGHTED_ANS( ($popup1)->cmp, 1 );

WEIGHTED_ANS( ($popup2)->cmp, 1 );


## Check for Equal Variances: 


WEIGHTED_ANS( ($nprime)->cmp, 5 );

WEIGHTED_ANS( ($npc)->cmp, 1 );


WEIGHTED_ANS( ($dfhn)->cmp, 2 );

WEIGHTED_ANS( ($dfhd)->cmp, 2 );

WEIGHTED_ANS( ($popup5)->cmp, 1 );

WEIGHTED_ANS( ($popup6)->cmp, 1 );

WEIGHTED_ANS( $fcrth->cmp() ->withPostFilter(AnswerHints(

$fcrth => "Yes!",

$fcrtw1 => "Wrong F-max Table, and both df are wrong: dfn = number of treatments, k, you used df = k - 1. And dfd = n' -1, but you summed data and subtracted the number of groups. You forgot the harmonic mean.",

$fcrtw2 => "Wrong F-max Table, and both df are wrong: dfn = number of treatments, k, you used df = k - 1. And dfd = n' -1, but you summed data and subtracted the number of groups. You forgot the harmonic mean. Also you are using the wrong alpha value.",

$fcrtw3 => "Wrong F-max Table. Your df is wrong: dfn = number of treatments, k, but you used df = k - 1.",

$fcrtw3 => "Wrong F-max Table. Your df is wrong: dfn = number of treatments, k, but you used df = k - 1. Also you are using the wrong alpha value.",

$fcrtw5 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. And your df are wrong: dfn = number of treatments, k, while you used df = k - 1.",

$fcrtw6 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. And your df are wrong: dfn = number of treatments, k, while you used df = k - 1. Also you have the wrong alpha value. Get it together!",

$fcrtw7 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table.",

$fcrtw8 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. And you are using the wrong alpha value.",

$fcrtw9 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also both df values are wrong and you did not use the harmonice mean. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw10 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also both your df values are wrong. You did not use the harmonic mean, n'-1 to find it. And your alpha value is wrong. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw11 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also your 2nd df value is wrong. You summed up data point rather than use the harmonic mean, n'-1 to find it. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw12 => "Wrong Table! You are using the ANOVA F-critical table but the test for equal variances uses the F-max table. Also your 2nd df value is wrong. You summed up data point rather than use the harmonic mean, n'-1 to find it. And your alpha value is wrong. Try checking out the example problem in Lecture Week 12 day 3.",

)),3 );

WEIGHTED_ANS( ($popup7)->cmp, 1 );

WEIGHTED_ANS( ($popup8)->cmp, 1 );

WEIGHTED_ANS( ($popup9)->cmp, 1 );

WEIGHTED_ANS( ($fsamh)->cmp, 7 );

WEIGHTED_ANS( ($popup99)->cmp, 1 );

WEIGHTED_ANS( ($fcrth)->cmp, 5 );

WEIGHTED_ANS( ($popup19)->cmp, 1 );

WEIGHTED_ANS( ($popupph)->cmp, 4 );

WEIGHTED_ANS( ($popup29)->cmp, 1 );

WEIGHTED_ANS( ($popup10)->cmp, 2 );

WEIGHTED_ANS( ($popup11)->cmp, 1 );

## Declare Variables:


WEIGHTED_ANS( ($popup3)->cmp, 2 );

WEIGHTED_ANS( ($popup4)->cmp, 2 );


##Declare Hypothesis and LOS:


WEIGHTED_ANS( ($popup30)->cmp, 2 );

WEIGHTED_ANS( ($popup31)->cmp, 2 );


WEIGHTED_ANS( ($poplos)->cmp, 2 );


### ANOVA Table Entries: 

#WEIGHTED_ANS( ($ssb)->cmp, 2 );

#WEIGHTED_ANS( ($ssw)->cmp, 2 );



WEIGHTED_ANS( ($dfb)->cmp, 2 );

WEIGHTED_ANS( ($msb)->cmp, 3 );

WEIGHTED_ANS( ($fsam)->cmp, 4 );


WEIGHTED_ANS( ($dfw)->cmp, 3 );

WEIGHTED_ANS( ($msw)->cmp, 3 );

WEIGHTED_ANS( ($sst)->cmp, 2 );


WEIGHTED_ANS( ($dft)->cmp, 1 );


WEIGHTED_ANS( ($pop21)->cmp, 2 );



##### ANOVA Statistical Conclusion:  Step 5


WEIGHTED_ANS( ($popup40)->cmp, 2 );

WEIGHTED_ANS( ($popup41)->cmp, 2 );

WEIGHTED_ANS( ($dfb)->cmp, 2 );

WEIGHTED_ANS( ($dfw)->cmp, 2 );

WEIGHTED_ANS( ($popup33)->cmp, 1 );

WEIGHTED_ANS( ($fsam)->cmp, 3 );

WEIGHTED_ANS( ($popup34)->cmp, 1 );

WEIGHTED_ANS( $fcrt->cmp() ->withPostFilter(AnswerHints(

$fcrt => "Yes!",

$fin => "No, We should never round a df up to infinity",

$fcrtw11 => "Wrong Table! You are using the ANOVA F-critical table (yes) but your first df value is wrong. You need to subtract one from the number of groups (k-1) to find it. Also your alpha is possibly wrong. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrtw12 => "Wrong Table! You are using the ANOVA F-critical table but your first df value is wrong. You need to subtract one from the number of groups (k-1) to find it. Try checking out the example problem in Lecture Week 12 day 3.",

$fcrth => "Wrong Table! That is the F-max critical value used for the equal variance test. You should be using the ANOVA F-critical table but your df value is wrong. You need to subtract one from the number of groups (k-1) to find it. Try checking out the example problem in Lecture Week 12 day 3. Also your alpha is likely wrong.",

$fcrtw1 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs. Also you are using the wrong alpha value.",

$fcrtw2 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs.",

$fcrtw3 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs. Also your 2nd df and alpha values are wrong.",

$fcrtw4 => "Wrong Table! You are using the F-Max table and but should be using F-critical table for ANOVAs. Also your 2nd df value is wrong.",

$fcrtw5 => "Wrong 2nd df and possibly alpha! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

$fcrtw6 => "Wrong 2nd df! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

$fcrtw7 => "Both df values and possibly alpha are wrong! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

$fcrtw8 => "Both df values are wrong! It seems like you used the harmonic mean to find your 2nd df when that method is only used for the equal variance test, not ANOVAs.",

)),4 );


WEIGHTED_ANS( ($popup44)->cmp, 1 );

WEIGHTED_ANS( ($popup45)->cmp, 3 );

WEIGHTED_ANS( ($popup46)->cmp, 1 );

WEIGHTED_ANS( ($popup47)->cmp, 1 );

WEIGHTED_ANS( ($popup48)->cmp, 1 );


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





BEGIN_PGML_SOLUTION



    *25.2) Step 1a:  Preliminary Checks*  

    * The data sets are collected from [$popup1] and random samples.  

    * With summarized data, we assume that all data sets [$popup2] a normality test by the Anderson-Darling normality test, as we are using mean values.  


    *25.2)  Step 1b:*   Check for Homoscedastity (equal variances):  

    

    [@

DataTable(

[

[["Site ", headerrow => 1],"N","\\(\\bar x\\) plasma carotenoids $BR concentration (\\(\\mu g/ml\\))", "Standard $BR deviation",],

[["$jnn" ], "$jn", "$jx", "$js"],

], 

caption => " ",

midrules => 1,

align => "|p{0.3in}|p{0.3in}|p{1.8in}|p{0.8in}|",

);

@]***  

    

    

    [@

DataTable(

[

[["Because of unequal sample sizes we must first calculate a harmonic mean for the grouped sample size, \\(n^{\\prime}.\\) $BR $BR Then \\(\\quad \\displaystyle{n^{\\prime} = \\frac{k}{\\frac{1}{n_1}+\\frac{1}{n_2}+...+\\frac{1}{n_k}} }\\) $BR $BR \\(\\displaystyle{n^{\\prime} = \\frac{4}{\\frac{1}{$nr[0]}+\\frac{1}{$nr[1]}+\\frac{1}{$nr[2]} +\\frac{1}{$nr[3]}}}\\) $BR $BR \\( n^{\\prime} = $nprime \\) $BR $BR The degrees of freedom for the equal variance test is \\( df = n^{\\prime} \\text{  (rounded up) } -1 \\) $BR $BR  \\(df = $npc - 1 = $npf\\) $BR $BR Now we can find the F-critical value for Hartley's F-max test for Equal variances by referencing the F-max table with 4 treatments: (at the right) $BR $BR With \\(k = 4 \\) groups (treatments) and \\(df = $npf \\)  and the standard LOS of 5% we find the \\(F_{critical} = F_{4, $npf} = $fcrth \\) $BR $BR Next we calculate the F-sample value for the F-max test: $BR $BR

\\(F_{sample} = \\frac{(sd_{max})^2}{(sd_{min})^2} = \\frac{($mxsd)^2}{($mnsd)^2} = $fsamh \\)"], " ",image( "Fmax4.png", width=>313, height=>632, tex_size=>700, extra_html_tags=>'alt="An image of the F-max table for F-critical values for degrees of freedom of 4." '  ) ],

], 

caption => " ",

midrules => 0,

align => "p{3.8in}p{0.3in}p{2.3in}",

);

@]***  

    

    

    

        Establish the decision line for Hartley's Equal variance test. Recognize that this is NOT the decision line for the ANOVA test, rather it is the decision line for the preliminary check of equal variances, without which we can not proceed with the ANOVA test.  

For Hartley's test: df = (k, [`n'`]-1) = [``\large{(4, [$npf] )}``]  

  

 [`\hspace{50pt}`] *Do Not Reject Ho* [`\hspace{120pt}`] *Reject Ho*  

[@ image( "DecisionLine2.png", width=>690, height=>25, tex_size=>700, extra_html_tags=>'alt="A decision for the hypothesis on equal variances." ' )@]***    

[``\hspace{160pt} \large{F_{4, [$npf] } = [$fcrth]}``] 

    

    

    *25.3) Step 1c:*  The statistical conclusion for Hartley's F test is:  


    At the [$popup7]  LOS we [$popup8]  the null hypothesis of  [``\large{H_o  }``], because:  

    

    

    [@

DataTable(

[

[" \\(\\large{F}\\)-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{10pt} \\large{F_{sample}} \\hspace{2pt} $popup9 \\hspace{2pt} \\large{F _{critical}}\\) $BR $BR \\( \\hspace{10pt} $fsamh $popup99 $fcrth \\) "],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    

    [@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{30pt}\\large{p} \\hspace{2pt} $popup19 \\hspace{2pt} \\large{\\alpha}\\) $BR $BR \\( $popupph  $popup29 $popup10 \\)" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    With the preliminary checks of independent and random samples, a normal distribution and equal variances, [$popup11] with a one-way ANOVA test.



    *25.3)  Step 2:*   Declare the variables for this hypothesis test:  

    

    

     [``\mu_i``] = The *mean* plasma concentration of carotenoids in ([`\mu g/ml`]) for a wild Egyptian vulture from the [`i^{th}`] region in Spain.  

     

     

     *25.3)  Step 3)*  Choose the correct hypothesis statement to test the claim that the mean emission rate in (ng/hour) for a potato plant varies depending upon the type of attacking insect. Test the hypothesis at a [$LOS]%  LOS.  


  

    [``\large{H_o \hspace{-3pt}: \hspace{3pt} \mu_1 = \mu_2 = \mu_3 = \mu_4 }``]  

  

    [``\large{H_a \hspace{-3pt}: \hspace{3pt} }``]  *At least one mean is not equal*  

  

    [``\large{\alpha = [$poplos]}``]  

    

    

        *25.3)  Step 4)*  Complete the partially filled ANOVA table as an aid in forming the  conclusion for the ANOVA hypothesis.  

  

    [@

DataTable(

[

[["Source ", headerrow => 1],"Sum of Squares $BR (SS)", "Degrees of $BR  freedom: df","Mean Squares $BR (MS)","F-sample"],

[["Between $BR Groups"], "SSB = $ssb",  "\\(df_b\\) = $dfb ", "MSB = $msb ", "\\(F_{Sample}\\) = $fsam "],

[["Within $BR Groups"], "SSW = $ssw" , "\\(df_w\\) = $dfw ", "MSW = $msw" , "$BBOLD Bracketed p-value: $EBOLD"],

[["Total"], "SST = $sst ", "\\(df_t\\) = $dft ", "", "  $pop21 "],

], 

caption => "ANOVA TABLE ",

midrules => 1,

align => "|p{0.6in}|p{1.3in}|p{1.1in}||p{1.4in}|p{2in}|",

);

@]***  

  

    

    

    *25.3),  Step 5)*  Write a statistical conclusion for the ANOVA hypothesis.

    

    

    At the [$popup40]  LOS we [$popup41]  the null hypothesis of  [``\large{H_o  }``], because:  

    

    

    [@

DataTable(

[

[" df and \\(\\large{F}\\) $BR Notation $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{2pt} df = (df_B , df_W ) =  ( $dfb , \\,  $dfw ) \\) $BR $BR \\( \\large{F_{sample}}  $popup33 \\large{F_{critical}}\\)   $BR $BR \\( $fsam $popup34 $fcrt \\)" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    

    [@

DataTable(

[

["p-Notational $BR Support: $BR $BR Numeric $BR Validation: "," \\(\\hspace{20pt} \\large{p} \\hspace{2pt} $popup44 \\hspace{2pt} \\large{\\alpha}\\) $BR $BR \\(\\hspace{2pt} $popup45 $popup46 $popup47 \\)" ],

  ], 

  caption => "  ",

  midrules=>0, 

  align => "p{1.2in}p{7in}"

);

@]***  

  

    *25.3),  Step 6)*   Write an English sentence conclusion.  

  

  

    The evidence supports the case that mean plasma carotenoid concentration in [`\mu g/ml`] of Egyptian vultures [$popup48] according to region.

    

    

    

END_PGML_SOLUTION




  


ENDDOCUMENT();

In reply to tim Payer

Re: The evaluated answer is not an answer hash : ||.

by Alex Jordan -
Is this problem in the OPL with the code just like this? If so, can you give its file path? And is there a particular seed that causes the issue? Also does this error message appear when loading the problem, or only after submitting an answer?


In reply to Alex Jordan

Re: The evaluated answer is not an answer hash : ||.

by Sean Fitzpatrick -
Every time I've seen this error, it's because a student has forgotten a bracket when entering some sort of data array (e.g. a matrix)
In reply to Sean Fitzpatrick

Re: The evaluated answer is not an answer hash : ||.

by Glenn Rice -

Any time the student sees this error (or any of the red errors below), it is because of a mistake made by the problem author or the WeBWorK developers.

Usually, this error is a result of something going wrong in a pre or post filter, or in the checker routine.  Adding some debug "warn" statements helps to figure out where it is occurring.

In reply to Glenn Rice

Re: The evaluated answer is not an answer hash : ||.

by Danny Glin -

The other place I've seen this is when an instructor modifies a question after a student has already attempted it, e.g. by adding/removing/changing an answer blank.  When WW tries to load the student's past answers it freaks out and this is the error it gives.

In reply to Glenn Rice

Re: The evaluated answer is not an answer hash : ||.

by Brittni Lorton -

I ran into this issue myself today and found myself here on this post. Any tips on how to make the correction? The place I am seeing the error is when a student uses the letter m, instead of actually calculating the slope numerically, in this problem on the OPL: https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/PCC/BasicAlgebra/PointSlopeForm/TwoPointsFindPointSlopeEquation10.pg 

Any tips on finding a solution? We'd prefer the student just be marked wrong if they use the letter m, not be prompted with this weird warning. 

In reply to Brittni Lorton

Re: The evaluated answer is not an answer hash : ||.

by Glenn Rice -

This problem is performing grading in a post filter.  Anytime that this is done care is needed to ensure that the parts of the answer hash that are used are defined.  In this case the authors need to ensure that the student_formula is defined.  So change lines 94 and 121 from

      if ($ansHash->{student_formula}->cmp_class eq "an Implicit line") {

to

      if (defined($ansHash->{student_formula}) && $ansHash->{student_formula}->cmp_class eq "an Implicit line") {

With this the students will get the answer message "Variable 'm' is not defined in this context", but here won't be warnings.  That message could probably be customized if desired.

In reply to Glenn Rice

Re: The evaluated answer is not an answer hash : ||.

by Brittni Lorton -

Brilliant. That did the trick. Since I am using this problem in a live class right now I just saved a local file and make your suggested adjustments. I'll submit this as a bug so hopefully the authors can make adjustments to the Library as well. Thank you, Glenn!

In reply to Brittni Lorton

Re: The evaluated answer is not an answer hash : ||.

by Glenn Rice -

One of the authors listed in the problem has already posted on this thread.  So he has probably already noted this.  He is pretty good about taking care of these things.

In reply to Glenn Rice

Re: The evaluated answer is not an answer hash : ||.

by Alex Jordan -
I haven't been following this, but Glenn's comment caught my eye and made me check if it was referring to me, which it was!

There's a larger issue in that this is an OPL "Library" problem (as opposed to a Contrib problem). I gave up trying to keep such problems up to date a long time ago. They were contributed at one point. Then the OPL maintainers tagged them and possibly made other edits. But at my school, we couldn't just switch to using the OPL versions because of the lag time in fixing inevitable bugs. At least at the time, back in 2013, I didn't know how I could use git better to make that possible. So the versions we use diverged from the OPL version as we fixed things. Recontributing to the OPL is a challenge because of conflicts with changes that have been made to the OPL versions (sometimes, I think, with mass edits that were done to all OPL files).

None of this is to say that the version we use doesn't have the same bug. It might. If you find the corresponding file in the OPL Contrib folder, that is closer to the one we actually use. There I can just drop our updated files with no concern about merge conflicts. It's still not necessarily what we are currently using, since maybe it has been a year or so since I last updated our corner of Contrib.

But a file diff on my system between the OPL and Contrib versions includes:
93a96
>       if (defined $ansHash->{student_formula}) {
and it sounds like that is part of what was a problem here.

Anyway I thought I'd bring up this systemic issue with OPL maintenance for further discussion (but perhaps somewhere other than this thread).