This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Math 127B, Basic R, Lecture 6 Mrinal Raghupathi Wednesday, April 20, 2011 Administrivia Today we will learn how to do a chisquare test in R. Reminders 1. This weeks recitation will again be like a lab for R, inclass. 1 The chisquare test in R The chisquare test is run with the command chisq.test . The command can do all the chisquare tests that we have looked at. This can be done by specifying different options. We will repeat three of the examples from previous classes. The first is rolls of a die. We roll a die 60 times and observe the following frequencies for each face: 11, 13, 15, 10, 9, 2. Create a list of frequencies for the rolls by rolls < c(11, 13, 15, 10, 9, 2) . The command chisq.test(rolls) will print out the following information > rolls < c(11, 13, 15, 10, 9, 2) > rolls [1] 11 13 15 10 9 2 > chisq.test(rolls) Chi squared test for given probabilities data: rolls Xsquared = 10, df = 5, pvalue = 0.07524 Note the Pvalue is given as a proportion and not as a percentage. So P = 7 . 524%. Next lets work out the example of the jurors in Alameda county California. Heres the table again. 1 Age Countywide % age Number 21 30 42 5 31 40 23 9 41 60 16 19 61 + 19 33 This time, there is a lot less information. We dont need it. TheThis time, there is a lot less information....
View
Full
Document
This document was uploaded on 10/29/2011 for the course MATH 127B at Vanderbilt.
 Spring '11
 Staff
 Statistics, ChiSquare Test

Click to edit the document details