R has probability functions available for use (see Davies, Chapter 16, adn Kabac
ID: 3235836 • Letter: R
Question
R has probability functions available for use (see Davies, Chapter 16, adn Kabacoff, Section 5.2.3). Using one distribution to approximate another is not uncommon. (a) The normal distribution may be used to approximate the binomial distribution if np > 5 and np(1-p) > 5. Find the following binomial probabilities using dbinom() and pbinom() with a probability, p = 0.5, and n = 100. Then, estimate the same probabilities using the normal approximation with continuity correction and pnorm() (b) The probability of exactly 50 successes. # calculate binomial probability # calculate normal approximation (ii) The probability of fewer than 42 successes. # calculate binomial probability # calculate normal approximation (iii) The probability of 58 or more successes. # calculate binomial probability # calculate normal approximation (c) With n = 100 and p = 0.01, use the binomial probabilities from dbinom() to calculate the expected value and variance for this binomial distribution using the general formulae for mean and variance of a discrete distribution (To do this, you will need to use integer values from 0 to 100 as binomial outcomes along with the corresponding binomial probability). Calculate the same using the formulae np and np(1-p). # Calculate expected value and variance using the binomial probabilities associated with # discrete outcomes # Calculate expected value and variance using n * p and n * p * (1-p)Explanation / Answer
#Solution for Part b
n=100
p=0.5
#(i)
dbinom(50,n,p)
pnorm(50.5,n*p,sqrt(n*p*(1-p)))-pnorm(49.5,n*p,sqrt(n*p*(1-p)))
#(ii)
pbinom(41,n,p)
pnorm(41.5,n*p,sqrt(n*p*(1-p)))
#(iii)
1-pbinom(57,n,p)
1-pnorm(57.5,n*p,sqrt(n*p*(1-p)))
#Solution for part c
n=100
p=0.01
#Expectation and variance using the general formula
E1=sum(seq(0,n)*dbinom(seq(0,n),n,p))
V1=sum(seq(0,n)^2*dbinom(seq(0,n),n,p))-E1^2
#Expectation and variance using the formula for binomal
E2=n*p
V2=n*p*(1-p)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.