Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Consider a modified version of the PLolya urn model in Problem 2 where we put the observed ball back into the urn together with

3. Consider a modified version of the PLolya urn model in Problem 2 where we put the observed ball

back into the urn together with a new ball of the other color. For instance, suppose we randomly

sample a ball from the urn and observe that it is red. We now put the red ball back to the urn

together with a new blue ball.

(a) Write an R function PolyaUrn v2(n.steps, urn = c("red","blue")) that works for this new

sampling scheme. The input and output of the function should be the same as in Problem 2.

Hints: When updating urn in the for loop, you should probably consider using conditional

expressions.

(b) Run PolyaUrn v2(n.steps = 200) once and plot the sample path of p.red. In the plot, make

sure to

set the y-axis limit to c(0,1);

properly label the axes;

add a horizontal reference line at 0.5 (abline(h = 0.5)).

(c) Repeat PolyaUrn v2(n.steps = 200) 300 times and graph all sample paths in a single plot.

Briefly comment on the difference between this graph and the one in 2(c).

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Psychotherapy: Theory, Research, Practice, Training

Answered: 1 week ago