twowayR - # Looking at relations between qualitative...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 # Looking at relations between qualitative variables: # Two-way tables # Read in data on flight delays from MMC p. 150 # Enter the cell counts in a matrix and convert to a table delay = matrix(c(718,5534,74,532),ncol=2,byrow=T) colnames(delay)=c("Alaska Air","Amer West") rownames(delay)=c("On time","Delayed") delay = as.table(delay) delay help(margin.table) # total for table margin.table(delay) # row totals - status margin.table(delay,1) # col totals - airline margin.table(delay,2) # marginal distribution of flight status margin.table(delay,1)/margin.table(delay) # marginal distribution of airline margin.table(delay,2)/margin.table(delay) help(prop.table) # joint distribution prop.table(delay) # note the this TABLE sums to 1: sum(prop.table(delay)) # Condition on rows (status) prop.table(delay,1) # Condition on cols (airline) prop.table(delay,2)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 # Dependence on a third variable. .. # Split into two tables based on departure city
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 3

twowayR - # Looking at relations between qualitative...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online