Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use R programming language to simulate the experiment and plot Suppose we are interested in P(A) for some event A. While the 1 / n

Use R programming language to simulate the experiment and plot

Suppose we are interested in P(A) for some event A. While the 1 / n rule is simple, a better 95% confidence interval is given by p 1.96 sqrt((p(1 p))/n) where p is still the proportion of times A occurs in our sample. This confidence is smaller, which is better, but still contains the true probability about 95% of the time.

Suppose our event of interest has P(A) = 1/10.

(a) Simulate 300 trials of the experiment and print out the resulting confidence interval using the formula above.

(b) In your simulation above, for each trial, 1,. . . , 300, plot the upper and lower end points of the confidence interval. That is, if n is the number of trials done so far, and un and ln are the upper and lower limits of the confidence interval based on n trials, plot the points (x, y) = (n, un) and (x, y) = (n, ln) for n = 1, . . . , 300.

(c) Repeat the experiment from part a) 1000 times and compute the fraction of the time the confidence interval contains the true probability, 1/10. This should happen about 95% of the time.

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

=+Where do you want to live and work?

Answered: 1 week ago