..ooo AT&T; 1:35 AM @ 1): 100%..\' HWA Homework 4.pdf 4 R is capable of performi
ID: 3330382 • Letter: #
Question
..ooo AT&T; 1:35 AM @ 1): 100%..' HWA Homework 4.pdf 4 R is capable of performing several functions involving distributions (discrete or continuous). For each distribution, there is a function that evaluates probabilities (or densities), a function that evaluates PXS x), and a function that generates random variables from that family. This problem serves primarily as an introduction to using those functions Assume that X ~ Bin(n 20, p-0.2) Calculate PIX-3) by hand Using R, check your answer from part (a) by typing dbinom(x-3,size-20, prob-0.2,log FALSE Recall discrete random variables take on specific values. So X will take on some value in a. b. c. 10, 1, 2,-,20). To generate 100.000 Bin(n = 20,p = 0.2) random variables, use the binomials e-rbinom(n 100000, size 20, prob 0.2) To tabulate these results, use the command If the random number generator is working properly, the proportion of binomials you generated equal to 3 should be your answer from part (a). Take the number of Binomials equal to 3 from the table and divide by 100,000 (the number of binomials).It won't be exact because of random error, but because you have generated so many, it should be close. d. In addition, note that the mean of a Bin(20,p=0.2) distribution is np stated in class that when you have a large number of observations, the sample mean should be close to this value. To determine whether this works for your data, use the 4. We e. To complete this problem, turn in the table you generated in part (c). 2 of 2 Courses Calendar To Do Notifications MessagesExplanation / Answer
n=20 and P=0.2
a) P(X=3) by hand
P(X=3) = nCx * Px *(1-P)n-x
= 20C3* 0.23 * 0.817
=0.2053
b) Using R
> dbinom(x=3,size=20,prob=0.20,log=FALSE)
[1] 0.2053641
Yes both answer of a) and b) are same .
C)
> binomials=rbinom(n=100000,size=20,prob=0.2)
> table(binomials)
binomials
0 1 2 3 4 5 6 7 8 9 10 11 12 13
1153 5752 13687 20513 21816 17666 10835 5417 2215 701 192 46 6 1
>
P(X=3) = 20513/100000 = 0.20513
Yes it is very closed 0.2053.
D)
> mean(binomials)
[1] 3.99728
Yes mean also closed 4 .
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.