binomR - pbinom(19,40,.5) #P(X<=19) ### graph...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 ### dbinom computes binomial density values P(X=k) ### pbinom computes binomial cumulative probabilities P(X <= k) ### dnorm computes values of the Normal density curve ### pnorm computes cumulative probabilities P(X <= x) ### normal approximation to binomial: ### binomial(n,p) approx. Normal(np, sqrt(np(1-p)) ### X is binomial(40,.5) dbinom(19,40,.5) #P(X=19) sum(dbinom(0:19,40,.5)) #P(X<=19) = P(X=0) + P(X=1) + . .. + P(X=19)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pbinom(19,40,.5) #P(X&lt;=19) ### graph the binomial density using vertical lines for probabilities plot(0:40, dbinom(0:40,40,.5), type=&quot;h&quot;) ### X is approx N(20, sqrt(10)) pnorm(19.5,20,sqrt(10)) #P(X&lt;=19)=P(X&lt;=19.5), due to continuity correction. z = (19.5 - 20)/sqrt(10) #using standardization method z pnorm(z) ### add the normal curve to the graph for comparison lines(0:40, dnorm(0:40, 20, sqrt(10)), lty=2)...
View Full Document

This note was uploaded on 09/11/2011 for the course STAT 200 taught by Professor Agniel during the Spring '09 term at University of Illinois at Urbana–Champaign.

Ask a homework question - tutors are online