Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rprogramming: Suppose we have two separate bags of balls.BagAhasNnumber ofballsinit, some white some black but we don't know how many of each color.BagBhasKwwhiteball(s) and blackball(s).YoudrawRnumberofballsfromBagA

Rprogramming:

Suppose we have two separate bags of balls.BagAhasNnumber ofballsinit, some white some black but we don't know how many of each color.BagBhasKwwhiteball(s) and blackball(s).YoudrawRnumberofballsfromBagA and move them to Bag B.Then , you draw T balls sequentially from Bag B.Suppose the sequence ofthetheseballsturnsouttobe[S1;S2;:::;ST].Weareinterestedin the composition of balls in Bag A. List your hypotheses and count up all the ways the observed data can happen. Which hypothesis would you believe more? [30 points] (a) What is the code to calculate the number of ways the observed sequence [S1; S2; : : : ; ST ] canhappenforeachhypothesis.YourfunctionshouldworkforanyvalueofN;Kw;Kb;R ;Tandforanysequenceofballs[S1;S2;:::;ST].[Rcodingonly] [20 points] (b) Which hypothesis is most likely when N = 20; Kw = 10; Kb = 10; R = 5 and the observed sequence is [W; B; B; W; B; W]. [10 points]

image text in transcribed
3. R programming : Suppose we have twoseparate bags of balls. Bag A has Nnumber of balls in it, some white some black but we don't know how many of each color. Bag Bhas Kw white ball (s) and Kbblack ball(s). Youdraw Rnumber ofballs from Bag A and move them to Bag B. Then , you draw Tballs sequentially from Bag B. Suppose the sequenceofthe these ballsturnsout to be [51, 52,..., Sr]. Weareinterestedin the composition of balls in Bag A. List your hypotheses and count up all the ways theobserved data can happen. Which hypothesis would you believe more? (30 points] (A) Write a code to to calculate the number of ways the observed sequence [Si, $2. ..., Sr] can happen for each hypothesis. Your function should work for any value of N, Kw, Kb, R , Tand for any sequence of balls [$1, 52,..., ST]. [Rcodingonly] 120 points] (b) Which hypothesis is most likely when N = 20, Kw = 10, Kb = 10, R = 5 and the observed sequence is [W. B. B. W. B. W]. [10 points]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excellence in Business Communication

Authors: John V. Thill, Courtland L. Bovee

9th edition

136103766, 978-0136103769

More Books

Students also viewed these Mathematics questions

Question

In Problems 4974, establish each identity. (37 + 0) = 2 cos sin 0

Answered: 1 week ago

Question

Please fill in highlighted areas and show excel formulas

Answered: 1 week ago