Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This needsto be done on R studio. If anyone can please help. For the Bernoulli d

ID: 3240936 • Letter: T

Question

This needsto be done on R studio. If anyone can please help.

For the Bernoulli distribution X Ber(p) = Bin(1; p), gure out the follow- ing problems:

1. Sample 50 points from X Ber(p0 = 0:2).

2. Calculate the sample proportion ^p of "s shown in the above sample you obtained.

3. Do you think it's reasonably good enough? Explain why.

4. Pretend that you forgot the probability of success p0 you used to generate the above sample of size 50. Your guess now is 0.4. And you want to gure out whether it is 0.4. Here are two ways for your choice, and which one do you think is more reasonable?

(a) Compare the sample proportion you got in above part 2 with your guess 0.4. If they are reasonably close, you probably will adopt your guess 0.4. Think about how could you judge the closeness.

(b) Here is the other procedure. The logic behind this is that if p0 = 0:4, what will happen? If something strange happened, then you should doubt your guess; if everything happend is reasonable under p0 = 0:4, then it seems no reason for you to reject your guess. Here is the implementation. Use p0 = 0:4 to generate N = 10000 samples from X Ber(p0 = 0:4) with sample size n = 50. And calculate the sample proportion for each of these N = 10000 samples, denoted by f^pk 50; k = 1; 2 ;N = 10000g. And then plot the histogram of f^pk 50; k = 1; 2 ;N = 10000g to see the distribution of the random variable sample proportion ^p50 under the 1 2 assumption that the true p0 = 0:4. And if the observed ^p is not in the extreme region of the distribution, you probably will adopt your guess 0.4. In particular, calculate the probability that ^p50 < ^p through the frequency of f^pk 50 < ^p; k = 1; 2 ;N = 10000g. This probability is actually related with the important concept in Statistics, p value!

5. For the above part (b), we are actually using simulation to approximate the probability of ^p50 = X1+X2++X50 50 < ^p given that fXi; i = 1; 2; ; 50g are independent and identically distributed as X Ber(p0 = 0:4). Could you gure the probability out exactly without any approximation? What is the exact probability?

6. For the above probability, we are actually also be able to approximate it without simulation. Remember by the central limit theorem for n = 50 > 30, ^p50 = X1 + X2 + + X50 50 approximate N(; 2=50) with = E(X) and 2 = V ar(X) for X Ber(p0 = 0:4). Use this approximation fact, please calculate the probability.

7. Compare the p values you obtained by the above three ways (simulation approximation, exact, CLT approximation), you should expect to see that the CLT approximation is as good as the simulation approximation. There is some empirical continuity correction about this CLT approximation. Please check out the online material https://people.richland.edu/james/ lecture/m170/ch07-bin.html to gure out how to conduct the correction to make the approximation better. Calculate the corrected probability.

Explanation / Answer

#1.
X=rbinom(50,1,0.2)
X
#2
sum(X)/50
#3
Yes. 0.18 is close enough to 2.
#4
#a. No they are not reasonably close.
#b.

for(i in 1:1000)
{
Y=rbinom(50,1,0.4)
prop[i]=sum(Y)
}
prop=prop/50
hist(prop)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote