Question

Part I: Ene concept of a percentile (equivalently, quantile) is very important in data analysis. It applies to both samples and distributions. So, lets get some wi practice with them, starting with the binomial distribution. In prelab, you learned that the function gbinom(p. size prob) gives the p-th quantile of the binomial distribution with parameters n - size and pi prob. tocus on the binomial distribution with parameters n-10 and pi-0.3.Then, the 38th percentile (or 0.38 quantile) of that distribution is qbinom (0.38, 10, 0.3) # 2 , le , the area to the left of x-2, under that binomi I dist bution is 0.38 (or 38%). height of p x) in You also learned from prelah2 that dbinom x, sze prob) gives the *value* of the binomial distribution, i e lecture notation. the a) Write code to compute the sum of the values of the binomial pl(x) for all integer xs between 0 and 2. Keep focusing on n-10, pi-0.3. Hopefully, your answer will be close to what qbinomO gave us above, because the sum of the heights of p(x) is supposed to be the area under p(x). (For technical reasons that we may discuss later, the answers may not be exactly the same; but they should be close.)Please solve on only PART 2 b) and c) , PART 1 is only for REFERENCE :)Part II: In this part well stay with the same binomial distribution, i.e, with n-10, pi-0.3. From lecture we know that the mean and variance of this distribution are, respectively, n*pi 3 and npi(I-pi) 2.1. But, suppose we want to know about the SAMPLE mean and SAMPLE variance of data/samples taken from that distribution. The past prelabs have taught you how to take a sample trom a distribution; check them out on the course website, if youve forgotten. b) Write code to take a sample of size 100 from our binomial distribution, and compute its mean and variance. Note that our notation is somewhat different from that used by R: We use n to denote the sample size and the n parameter of the binomial distribution; R uses n to denote sample size, but uses size to denote the n parameter of binomial. Now, lets see how the sample mean and sample variance of samples taken from our binomial distribution depend on the sample size. But, to do that, it helps if we know how to do for loops (also known as do-loops): Here is an example of how to set-up a for-loop, with explanation on each line. Study it. xy numeric(100) fort i in 1:100) yli-log(i) plot(x, y, type-b, y limo(0,6)) # Allocate space to two arrays called x and y. # loop over value of,-1, 2, , 100, and # compute 2, inserting it in the ith spot in x, and # compute log(i), inserting it in the ith spot of y. # The end of the for-loop. # Now, you can rmake a graph ofy vs. x. # The ylim is important; it urges plot() to show the y-axis from 0 to 6. c) Write code to take samples of size 12, 2*2, 3,502, compute the sample mean and sample variance for each of the sample sizes, and then plot them as a function of sample size. You may make two separate plot them on a single plot-up to you s (one for mean, one for variance), or overlay

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(b) We use the rbinom function to draw a sample of size 100 from the binomial distribution p(x) and then calculate mean and variance in the following way:
a = rbinom(100, 10, 0.3)
mean(a)
var(a)


(c) We compute the 2 graphs in the following way:
x1 = x2 = y = numeric(50)
for(i in 1:50)
{
   y[i] = i^2
   x1[i] = mean(rbinom(y[i],10,0.3))
   x2[i] = var(rbinom(y[i],10,0.3))
}
par(mfrow=c(1,2))
plot(y,x1,type="o",main="Sample size vs Means")
plot(y,x2,type="o",main="Sample size vs Variances")

Add a comment
Know the answer?
Add Answer to:
Please solve on only PART 2 b) and c) , PART 1 is only for REFERENCE...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Part I: Ene concept of a percentile (equivalently, quantile) is very important in data analysis. It...

    Part I: Ene concept of a percentile (equivalently, quantile) is very important in data analysis. It applies to both samples and distributions. So, let's get some wi practice with them, starting with the binomial distribution. In prelab, you learned that the function gbinom(p. size prob) gives the p-th quantile of the binomial distribution with parameters n - size and pi prob. tocus on the binomial distribution with parameters n-10 and pi-0.3.Then, the 38th percentile (or 0.38 quantile) of that distribution...

  • please i need to solve 2 and 3 and please explain everything and write I commend...

    please i need to solve 2 and 3 and please explain everything and write I commend sing R please, 1. Generate 5,000 iid samples from the standard normal distribution; compute the mean of these random samples. Repeat this process 100 times so you would have stored 100 sample averages. Plot the sample averages using hist() and lines(density() in R. What do you observe? 2. Compute the mean and variance of Binomial distribution with parameters m and p directly from definition...

  • Part D: 1. Draw 500 random samples of size 8 from a random number generator from...

    Part D: 1. Draw 500 random samples of size 8 from a random number generator from a standard normal distribution. Then increase the sample size to 32. Finally, increase the sample size to 128. Plot histograms of the sampling distributions of (i) the sample mean andi) the sample variance, for each of these three sample sizes. Now repeat your experiments for three samples drawn from another parametric distribution of your choice (e.g., a uniform distribution) Discuss the results of your...

  • please solve b and c part i) 0,25. For rand population, obta Jon distribution of X...

    please solve b and c part i) 0,25. For rand population, obta Jon distribution of X and Y. Are 8 and Y Hupunuent? 4+2 (b) Ages of 5 persons have me ons have incan recorded as (in years) 14, 19. 17, 25. For random samples of size 3 drawn without replacement from this ulation, obtain the sampling distribution of sample mean (K). Show at the mean of x equals the population mean and obtain the standard 2+2+2 (c) (i) Form...

  • This is a multiple choice problem. The answer is either A, B, or C. In San...

    This is a multiple choice problem. The answer is either A, B, or C. In San Francisco, 30% of workers take public transportation. A sample of 10 workers is chosen. To find the probability that exactly 3 workers out of the sample of ten take public transportation, we would compute: A.) the cumulative binomial distribution with n = 3, p = 0.3, and x = 10 B.) the binomial probability mass function with n = 10, p = 0.3, and...

  • Lesson 6.2.4: Binomial Distribution and Sample Proportions A sample proportion, such as the one computed in...

    Lesson 6.2.4: Binomial Distribution and Sample Proportions A sample proportion, such as the one computed in Question 4, is equal to a number of successes (x), divided by the sample size (n). The notation for a sample proportion is p, and it is computed by the formula p = Each value of x corresponds to a unique sample proportion ( p ), as computed by this formula. For example, x = 1 implies p = + - 0.10. These events,...

  • The following distributional facts apply in this part: All variables are jointly normal and the marginals...

    The following distributional facts apply in this part: All variables are jointly normal and the marginals are as follows: N(m,s ): This is the notation for the Normal distribution with mean m and standard deviations . X~N(5,2) Y~N(2,3) Z~N(0,1) W~N(-4,6) U~N(0,5) V~N(24,1) Covariances between these variables are: sxy =.4, sxw =-.5, swu =1, suv =2; allothercovariancesare0. We have a random sample of size 6 from the distribution of X. We have a random sample of size 10 from the distribution...

  • Part Two. Can you help me with the binomial probability distribution? Please see instructions below. Please...

    Part Two. Can you help me with the binomial probability distribution? Please see instructions below. Please show all steps to understand better. Thank you in advance. 5. Use the binomial distribution table to find the binomial probabilities for these cases: a) n=10, p=1, k= 3 b) n=14, p = 6, k = 7 c) n =25, p=5, k = 14 6. Consider a binomial experiment with n = 20 and p=0.70. Use the binomial formula to calculate: a) P(x =...

  • Help me the part b please, if possible part c too The binomial distribution is B(n,pl-probability...

    Help me the part b please, if possible part c too The binomial distribution is B(n,pl-probability for variable X to be equal to K P(X-k) with m we define-np, which is the probability of success for n events each with probability p we take the limit when う00 (we consider a very large number of events M-1 2 Mass (Da) 2. Poisson distribution a. Show that the Poisson distribution,p(kl)arises from the binomial distribution in the limit that p 1 and...

  • python C-E please C) Generate 1,000, 000 samples from the random variable X of part B. Estimate the empirical mean o...

    python C-E please C) Generate 1,000, 000 samples from the random variable X of part B. Estimate the empirical mean of X. Plot the pmf of the samples of X. Now suppose you know that you have already played the wheel a few times (say t 3 times), and you have not won yet. Let's define Y:= X-3 for all X> 3. D) Of the samples generated in part C, keep all the samples greater than t 3 and discard...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT