# R-program for Supplementary Exercise 5.59 of IPS7e # binomial distribution # P(463<=X<=523) = P(X<=523) - P(X<=462) pbinom(523,1006,0.49) - pbinom(462,1006,0.49) # normal approximation of binomial probability pnorm((523+0.5-1006*.49)/sqrt(1006*.49*.51)) - pnorm((463-0.5-1006*.49)/sqrt(1006*.49*.51)) pnorm(523.5, 1006*.49, sqrt(1006*.49*.51)) - pnorm(462.5, 1006*.49, sqrt(1006*.49*.51)) # direct normal approximation of distribution of p_hat pnorm((0.52-0.49)/sqrt(.49*.51/1006)) - pnorm((0.46-0.49)/sqrt(.49*.51/1006)) pnorm(0.52, 0.49, sqrt(.49*.51/1006)) - pnorm(0.46, 0.49, sqrt(.49*.51/1006))