In: Statistics and Probability
9. Suppose that DVDs in a certain shipment are defective with a Beta distribution with α = 2 and β = 5. Use R to compute the probability that the shipment has:
a) 20% to 30% defective DVDs.
b) Less than 10% defective DVDs.
c) More than 25% defectives.
d) Set up the integral to find the probability that there is between 10% and 40% defectives. Then find the answer with R.
Given data follows beta distribution with
then ,
#Random number generation
p=rbeta(50,2,5)
p
#20% to 30% defective DVDs
D=pbeta(0.3,2,5)-pbeta(.2,2,5)
D
#less than 10% defective DVDs
LD=pbeta(.10,2,5)
LD
#More than 25% defective
MD=pbeta(.25,2,5,lower=F)
MD
#10% to 40% defective DVDs
D=pbeta(0.4,2,5)-pbeta(.1,2,5)
D
ANSWER
p=rbeta(50,2,5)
> p
[1] 0.33525159 0.40475736 0.33494896 0.33931759 0.77575651
0.21931675
[7] 0.14948975 0.26728552 0.30995125 0.36932356 0.22764835
0.21471545
[13] 0.17399571 0.23928556 0.10755878 0.36965143 0.07485323
0.27514441
[19] 0.24465168 0.60415653 0.10913094 0.47693667 0.12814216
0.40777194
[25] 0.22353339 0.22941899 0.35387726 0.39870388 0.42905823
0.33479674
[31] 0.07990354 0.12944578 0.03134308 0.25032622 0.44486543
0.18881404
[37] 0.52870911 0.16775588 0.09361808 0.07542389 0.30773208
0.57031194
[43] 0.29524329 0.54738416 0.31677122 0.48244908 0.25418352
0.11410115
[49] 0.16632487 0.29064165
>
> #20% to 30% defective DVDs
> D=pbeta(0.3,2,5)-pbeta(.2,2,5)
> D
[1] 0.235185
>
> #less than 10% defective DVDs
> LD=pbeta(.10,2,5)
> LD
[1] 0.114265
>
> #More than 25% defective
> MD=pbeta(.25,2,5,lower=F)
> MD
[1] 0.5339355
>
> #10% to 40% defective DVDs
> D=pbeta(0.4,2,5)-pbeta(.1,2,5)
> D
[1] 0.652455
>