R programming: Suppose we have two separate bags of balls. Bag A has N number of balls in it, some white some black but we don't know how many of each color. Bag B has Kw white ball(s) and K, black ball(s). You draw R number of balls from Bag A and move them to Bag B. Then, you draw T balls sequentially from Bag B. Suppose the sequence of the these balls turns out to be [S1, S2, . .. , ST]. We are interested in 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? (a) Write a code to to calculate the number of ways the observed sequence [S1, S2, . .. , ST] can happen for each hypothesis. Your function should work for any value of N, Kw, Kb, R, T and for any sequence of balls [S1, S2,.. . , ST]. [R coding only] (b) Which hypothesis is most likely when N = 20, Kw = 10, K, = 10, R = 5 and the observed sequence is [W, B, B, W, B, W].
R programming: Suppose we have two separate bags of balls. Bag A has N number of
balls in it, some white some black but we don’t know how many of each color. Bag B
has Kw white ball(s) and Kb black ball(s). You draw R number of balls from Bag A
and move them to Bag B. Then, you draw T balls sequentially from Bag B. Suppose
the sequence of the these balls turns out to be [S1; S2; : : : ; ST ]. We are interested in
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?
(a) Write a code to to calculate the number of ways the observed sequence [S1; S2; : : : ; ST ]
can happen for each hypothesis. Your
N;Kw;Kb;R; T and for any sequence of balls [S1; S2; : : : ; ST ]. [R coding only]
(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].
Trending now
This is a popular solution!
Step by step
Solved in 2 steps