Академический Документы
Профессиональный Документы
Культура Документы
http://www.stat.tamu.edu/~sheather/book/r_code.php
http://dist.stat.tamu.edu/pub/rvideos/
http://www.stat.tamu.edu/~sheather/book/data_sets.php
#Please change the file path in the command below to coincide with where you have
stored the data files
setwd("C:/Users/sheather.ADSTAT/Documents/docs/AModernApproachToRegression/Data")
attach(kicker)
#p-values on page 3
fit.1 <- lm(FGt~FGtM1 +Name +FGtM1:Name,data=kicker)
anova(fit.1)
detach(kicker)
detach(circulation)
detach(nyc)
detach(Bordeaux)
==========================
#March 17, 2009
#Please change the file path in the command below to coincide with where you have
stored the data files
setwd("C:/Users/sheather.ADSTAT/Documents/docs/AModernApproachToRegression/Data")
#R output on page 19
m1 <- lm(RunTime~RunSize)
summary(m1)
#t-value on page 23
tval <- qt(1-0.05/2,18)
tval
#R output on page 27
predict(m1,newdata=data.frame(RunSize=c(50,100,150,200,250,300,350)),interval="conf
idence",level=0.95)
predict(m1,newdata=data.frame(RunSize=c(50,100,150,200,250,300,350)),interval="pred
iction",level=0.95)
#R output on page 30
anova(m1)
detach(production)
#R output on page 31
m1 <- lm(Changeover~New)
summary(m1)
#t-value on page 33
tval <- qt(1-0.05/2,118)
tval
detach(changeover_times)
#################EXERCISES
#Exercise 2.8.1
detach(playbill)
#Exercise 2.8.3
detach(invoice)
#Exercise 2.8.5
problem5 <- read.table("Ch2Problem5.txt",header=TRUE)
attach(problem5)
detach(problem5)
======================================
#Please change the file path in the command below to coincide with where you have
stored the data files
setwd("C:/Users/sheather.ADSTAT/Documents/docs/AModernApproachToRegression/Data")
detach(anscombe)
detach(huber)
detach(bonds)
m1 <- lm(RunTime~RunSize)
detach(production)
detach(cleaning)
detach(confood1)
detach(responsetransformation)
library(alr3)
data(salarygov)
attach(salarygov)
detach(salarygov)
#################EXERCISES
#Exercise 3.5.1
airfares <- read.table("airfares.txt",header=TRUE)
attach(airfares)
detach(airfares)
#Exercise 3.5.4
glakes <- read.table("glakes.txt",header=TRUE)
attach(glakes)
detach(glakes)
#Exercise 3.5.5
cars04 <- read.csv("cars04.csv",header=TRUE)
attach(cars04)
detach(cars04)