Sheet1
Page 1
# illustrate use of prop.test function for large sample inferences
# about proportions, and binom.test function for exact binomial about
# a single proportion
######## test and confidence interval for population proportion ###################
# Ex 1. To test whether a coin is fair, we tossed it 100 times and got heads 57 times.
# should we be suspicious?
# large n test of Ho: p=1/2 versus p: != 1/2
# It uses a continuity correction and also gives a 95% confidence interval:
prop.test(53,100)
# Comment: the Xsquared value with 1 df is equal to the square of the Z statistic.
# In general the square of a Normal(0,1) random variable is a Chisquare with 1 degree
# of freedom. We can compute chisquare probabilities using the "pchisq" function.
# Type help(chisq) for more information.
# Here's a onetailed version:
prop.test(53,100,alternative="greater")
# Ex 2. Roll a sixsided die 50 times. Get "6" ten times. Should we be suspicious?
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '09
 Agniel
 Statistics, Binomial, #, 1 degree

Click to edit the document details