# Lab2 Solutions - attach(galton cor(child parent cor(child...

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

Lab #2 Solutions # 3.2 spam <- c(50, 110, 225, 315, 390, 450) total <- c(125, 210, 375, 475, 590, 700) names(spam) <- c("2000", "2001", "2002", "2003", "2004", "2005") non.spam <- total - spam #recreating the table from the book: spam.table <- rbind(spam, total) spam.table #barplot: barplot.data <- rbind(spam, non.spam) barplot(barplot.data, legend.text=TRUE) # 3.5 library(UsingR) attach(florida) total <- BUSH + GORE vote.pcts <- rbind(BUSH/total, GORE/total) barplot(vote.pcts, legend.text=TRUE) # it does not stick very close to 50% in many counties. # 3.14
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: attach(galton) cor(child, parent) cor(child, parent, method="s") # 3.16 attach(fat) plot(body.fat, BMI) cor(body.fat, BMI) # 3.18 x77 <- data.frame(state.x77) attach(x77) plot(Population, Frost) # doens't appear linear. plot(Population, Murder) # doesn't appear linear. i would have expected this to be more closer to a positive linear association. plot(Population, Area) # really doesn't appear linear. plot(Income, HS.Grad) # ah, fairly linear. # 3.19 # my guess: -0.24 cor(age, time) # [1] 0.1898672 # whoa, way off!...
View Full Document

## This note was uploaded on 04/27/2009 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