{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# r6 - Math 127B Basic R Lecture 6 Mrinal Raghupathi...

This preview shows pages 1–2. Sign up to view the full content.

Math 127B, Basic R, Lecture 6 Mrinal Raghupathi Wednesday, April 20, 2011 Administrivia Today we will learn how to do a chi-square test in R. Reminders 1. This week’s recitation will again be like a lab for R, in-class. 1 The chi-square test in R The chi-square test is run with the command chisq.test . The command can do all the chi-square 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 X-squared = 10, df = 5, p-value = 0.07524 Note the P -value is given as a proportion and not as a percentage. So P = 7 . 524%. Next let’s work out the example of the jurors in Alameda county California. Here’s the table again.

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.

{[ snackBarMessage ]}

### Page1 / 4

r6 - Math 127B Basic R Lecture 6 Mrinal Raghupathi...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online