In: Statistics and Probability
USE R CODING! Pleaseee I need the code With R coding Obs: it supposed to use probability density function like X ~ Binomial( n ,p ) dbinom(X=?, n, prob) pbinom(X=?, n, prob) rbinmo(幾個符合二項分配的X, n, prob) X~Poisson (lamda) dpois(X=?, lamda) ppois (X=?, lamda) rpois (X, lamda)
**Suppose the random variable X obeys the binomial allocation B (n=100, p=0.1)
(a) Use X as the binomial allocation to calculate P(12≤X≤14)
(b) In practice, when np ≥ 5 and n(1-p) ≥ 5, X will approach normal assignment. E(X)=np, Var(X)=np(1-p), using this characteristic to calculate P(12≤X≤14), continuous correction is considered
(c) In practice, when n≥100 and np≤10, X will approach the Budisson distribution, E(X)=np, and use this characteristic to calculate P(12≤X≤14)
X follows binomial distribution with n = 100 and p = 0.1
a) P(12≤X≤14) = P( x = 12) + P( x = 13 ) + P( x = 14 )
To find the binomial probability for exact value of x. we use function dbinom(x,n,p)
dbinom(12,100,0.1)+dbinom(13,100,0.1)+dbinom(14,100,0.1)
Answer : 0.2244
b) n*p = 10 and n*q = 90 both n*p and n*q are greater than 5 , so we can use normal approximation.
So mean = n*p = 10 and standard deviation = = = 3
Now we need to use continuity correction by subtraction 0.5 from 12 and adding 0.5 to 14
So P( 12-0.5 ≤X≤14+0.5)
P( 11.5 ≤ X ≤14.5 ) = P( x ≤ 14.5 ) - P( x ≤ 11.5)
R code : pnorm(14.5,10,3,lower.tail = TRUE) - pnorm(11.5,10,3,lower.tail = TRUE)
Answer : 0.2417
c) We have n = 100 and np = 10 . so we can use Poisson approximation to binomial
So lambda = n*p = 10
P(12≤X≤14) = P( x = 12) + P( x = 13 ) + P( x = 14 )
To find the Poisson probability for exact value of x. we use function dpois(x, lambda)
R code : dpois(12,10)+dpois(13,10)+dpois(14,10)
Answer : 0.2198