# DESCRIPTION # Binomial probability # WeBWorK problem written by TimPayer # ENDDESCRIPTION ## DBsubject(Statistics) ## DBchapter(Exploratory data analysis/descriptive statistics) ## DBsection(Summary statistics) ## Institution(Humboldt State University) ## Author(Tim Payer) ## KEYWORDS(summations, mean, sd) DOCUMENT(); loadMacros( "PGstandard.pl", "niceTables.pl", "unionTables.pl", "PGunion.pl", "MathObjects.pl", "PGML.pl", "parserPopUp.pl", "weightedGrader.pl", "answerHints.pl", ); TEXT(beginproblem()); install_weighted_grader(); Context("Numeric"); #install_weighted_grader(); #install_problem_grader(~~&std_problem_grader); $showPartialCorrectAnswers = 1; Context()->flags->set( tolerance => 0.0001, tolType => "absolute", );$p = random(0.06, 0.10, 0.01); $pc = Compute("$p*100"); ## p as a percentage $pn = Compute("1-$p"); # Compliment of p $n = random(9, 18, 1);$x = random(1, 4, 1); $xn = Compute("$n - $x"); # Compliment of x$mean = Compute("$n*$p"); $sd = Compute("sqrt($n*$p*(1-$p))"); $lb =$mean -$sd;$ub = $mean +$sd; $ftn = fact($n); $ftx = fact($x); $ftxn = fact($xn); $ans1 = Compute("$ftn/($ftx*$ftxn)*$p**$x*$pn**$xn"); #$ftx1 = fact($x-1); $ftn1 = fact($n-1); #$ftx2 = fact($x-2); $ftn2 = fact($n-2); #$ftx3 = fact($x-3); $ftn3 = fact($n-3); $n1 = Compute("$n-1"); $n2 = Compute("$n-2"); $n3 = Compute("$n-3"); $a0 = Compute("$ftn/(1*$ftn)*$p**0*$pn**$n"); # prob of choose 0. $a0c = Compute("1-$a0"); # comp prob of choose 0. $a1 = Compute("$ftn/(1*$ftn1)*$p**1*$pn**($n-1)"); # prob of choose 1. $a1c = Compute("1-$a1"); # comp prob of choose 1. $a2 = Compute("$ftn/(2*$ftn2)*$p**2*$pn**($n-2)"); # prob of choose 2. $a2c = Compute("1-$a2"); # comp prob of choose 1. $a3 = Compute("$ftn/(6*$ftn3)*$p**3*$pn**($n-3)"); # prob of choose 3. $a3c = Compute("1-$a3"); # comp prob of choose 1. if($x == 1 ) {$xt ='one'; ## P(x > = 1) = 1 - P(x = 0) $d20 = "- P(x = 0) ";$d2 = " 1 - \binom{$n}{0}\cdot ($p)^0 \cdot ($pn)^{$n} "; $d22 = " 1 -$a0 "; $ans2 = Compute("1 -$a0"); } elsif ($x == 2) {$xt ='two'; ## P(x > = 2) = 1 - P(x = 0) - P(x = 1) $d20 = " - P(x = 0) - P(x = 1) ";$d2 = " 1 - \binom{$n}{0}\cdot ($p)^0 \cdot ($pn)^{$n} - \binom{$n}{1}\cdot ($p)^1 \cdot ($pn)^{$n1}"; $d22 = " 1 -$a0 - $a1 ";$ans2 = Compute(" 1 - $a0 -$a1"); } elsif ($x == 3) {$xt ='three'; ## P(x > = 3) = 1 - P(x = 0) - P(x = 1) - P(x = 3) $d20 = " - P(x = 0) - P(x = 1) - P(x = 2) ";$d2 = " 1 - \binom{$n}{0}\cdot ($p)^0 \cdot ($pn)^{$n} - \binom{$n}{1}\cdot ($p)^1 \cdot ($pn)^{$n1} - \binom{$n}{2}\cdot ($p)^2 \cdot ($pn)^{$n2}"; $d22 = " 1 -$a0 - $a1 -$a2"; $ans2 = Compute(" 1 -$a0 - $a1 -$a2 "); } else { $xt ='four'; ## P(x > = 3) = 1 - P(x = 0) - P(x = 1) - P(x = 3)$d20 = " - P(x = 0) - P(x = 1) - P(x = 2) - P(x = 3) "; $d2 = " 1 - \binom{$n}{0}\cdot ($p)^0 \cdot ($pn)^{$n} - \binom{$n}{1}\cdot ($p)^1 \cdot ($pn)^{$n1} - \binom{$n}{2}\cdot ($p)^2 \cdot ($pn)^{$n2} - \binom{$n}{3}\cdot ($p)^3 \cdot ($pn)^{$n3}";$d22 = " 1 - $a0 -$a1 - $a2 -$a3 "; $ans2 = Compute(" 1 -$a0 - $a1 -$a2 - $a3 "); } #################### Begin Problem Display BEGIN_PGML [@ DataTable( [ [["$BBOLD 5.) $EBOLD The common Pacific Tree Frog,$BITALIC Hyla regilla$EITALIC, is native to Humboldt county and all coastal counties to the North through Britsh Columbia. The tree frog is between 1-2 inches long, and is colored bright green with a mask line that runs from nose to neck. According to researchers the green color typical of many frogs is created by yellow pigment layered over gray cells, which in turn makes the frog look green to human eyes. In some cases, the yellow pigment is missing. And due to this genetic abnormality, the frog appears blue. What is not known is what causes the genetic mutation of the missing yellow pigment for a given frog. And so it was that in the year 2008, Eureka resident Linda Lange spotted a such a curious visitor in her garden. She called up HSU~~'~~s natural history museum and eventually donated the blue frog to all to see.$BR $BR Suppose that the incidence of blue tree frogs is$pc%. (Note that the true incidence blue tree frogs is much much lower than this, but let us accept this percentage for this problem). $BR$BR Answer the the following questions using probability notation. Show all work for full credit: $BR$BR $BR$BBOLD 5.a) 1pt: $EBOLD Declare the event variable for this problem set.$BR $BR$BR $BR$BBOLD 5.b) 4pts: $EBOLD Find the probability of drawing$xt blue tree frog(s) from a random draw of $n tree frogs.$BR $BR$BR $BR$BBOLD 5.c) 7pts: $EBOLD Find the probability of drawing at least$xt blue tree frog(s) from a random draw of $n tree frogs.$BR $BR$BR $BR$BBOLD 5.d) 4pts:$EBOLD Find the typical range for the number of blue tree frogs drawn from a random draw of$n tree frogs as expressed as a first standard deviation window. $BR$BR Excerpted from the Humboldt State NOW page. $BR Author: Jarad Petroske "]," The Pacific tree frog,$BBOLD $BITALIC Hyla regilla$EITALIC $EBOLD perched on a$BR sunflower stem \$$\\hspace{5.9cm} \$$" .image("TreefrogSun.png", width=>751, height=>482, tex_size=>700,extra_html_tags=>'alt="A photo of a green Pacific tree frog perched on a stem of a sunflower plant" ').$BR."photo by Kjfmartin$BR $BR A close-up photo shot of the rare blue Pacific tree frog clinging to a vertical leaf. \$$\\hspace{3cm}\$$".image("Treefrogblue.png", width=>528, height=>723, tex_size=>700,extra_html_tags=>'alt="A photo of a rare blue Pacific tree frog clinging vertically to the edge of a leaf" ').$BR."photo by Kelly Jo Brown $BR$BR $BR$BR BR "], ], caption => " ", midrules => 0, align => "p{4.7in}p{3.4in}", ); @]*** END_PGML ################ Weighted Answers ###### #WEIGHTED_ANS( (p)->cmp, 10 ); #WEIGHTED_ANS( ($pop1)->cmp, 3 ); #WEIGHTED_ANS( ($ans1)->cmp, 15 ); #WEIGHTED_ANS( ($pop2)->cmp, 3 ); #WEIGHTED_ANS( ($ans2)->cmp, 15 ); #WEIGHTED_ANS( ($pop3)->cmp, 3 ); #WEIGHTED_ANS( ($ans3)->cmp, 19 ); ## WEIGHTED_ANS( ($lb)->cmp, 10 ); #WEIGHTED_ANS($lb->cmp() ->withPostFilter(AnswerHints( #$lb => "Yes!", #$ub => "No, The lower bound of an sd window requires that you subtract the sd from the mean: (\mu - \sigma). You have instead added the mean to the sd: (\mu + \sigma).", #)),15 ); #WEIGHTED_ANS( ($ub)->cmp, 15 ); BEGIN_PGML_SOLUTION *SOLUTION* *5.)* Suppose that the incidence of blue tree frogs is [$pc]%. Answer the the following questions using probability notation. Show all work for full credit: *5.a) 1pt* Declare the event variable for this problem set. [x = ] The number of blue tree frogs drawn from a random sample of [$n] tree frogs. *5.b) 4pts:* Find the probability of drawing [$xt] blue tree frog(s) from a random draw of [$n] tree frogs. [P(x = [$x] ) = \binom{[$n]}{[$x]}\cdot ([$p])^[$x] \cdot ([$pn])^[$xn] = [$ans1] ] *5.c) 7pts:* Find the probability of drawing at least [$xt] blue tree frog(s) from a random draw of [$n] tree frogs. Use a compliment calculation to reduce the busy work of the binomial: [P(x \ge [$x] ) = 1 [$d20] ] [ = [$d2] ] [ = [$d22] ] [ = [$ans2] ] *5.d) 4pts:* Find the typical range for the number of blue tree frogs drawn from a random draw of [$n] tree frogs as expressed as a first standard deviation window. For a binomial experiment [\mu = n \cdot p] Then [ \mu = n \cdot p = [$x] \cdot [$p] = [$mean] ] For a binomial experiment [\sigma = \sqrt{n \cdot p \cdot (1- p)}] [\sigma = \sqrt{[$n] \cdot [$p] \cdot (1- [$p])}] [\sigma = [$sd]] Then the sd window for a binomial experiment can be described by: [\mu \pm \sigma] [ \mu \pm \sigma = [$mean] \pm [$sd]] [ \mu \pm \sigma = \left( [$lb] , \hspace{1cm} [$ub] \right) ] END_PGML_SOLUTION ENDDOCUMENT();