STAT 425 Exam #1
October 5, 2016
7:00 8:30pm
Problem 1 : (2pt each) Circle the correct answer.
1. We can measure the proportion of the variation explained by the regression
model by:
(a) r
(b) R2
(c) 2
(d) F -stat
2. In a simple linear regression model Y
#problem 1
#a
library(alr4)
data(MinnWater)
pairs(MinnWater)
#b
#allUse, muniUse and irrUse have especially high sample correlations with each
other
#c
mod=lm(muniUse~., data=MinnWater)
summary(mod)
#d
vif(mod)
which(vif(mod)>10)
#variables year, allUse,
#problem 1
#a
library(alr4)
library(MASS)
data(ais)
mod=lm(Wt~Ht, data=ais)
boxcox(mod)
#from the graph, lambda=0 is still in the 95% interval
#so the simplest transformation is to take lambda=0
#that is, log transformation
#b
mod1=lm(log(Wt)~Ht, data=ais
#question 1
#a
library(alr4)
data(lathe1)
mod=lm(Life~Feed+Speed+I(Feed^2)+I(Speed^2)+I(Feed*Speed), data=lathe1)
summary(mod)
#the interaction term is significant
#b
par(mfrow=c(2,2)
plot(mod)
#c
#from the Q-Q plot, we can say that the errors are not nor
BFHS <- read.table("~/Downloads/BFHS.dat", header=TRUE, quote="\")
#problem 1
#a
summary(BFHS)
#b
t.test(BFHS$Intervention-BFHS$ExternalComparison)
#the p value is 0.06067, which is larger than 0.05
#the difference between the two groups are not significa
STAT 425 Homework 1 Solution
Problem 1
Consider SLR model. Explain how 0 , 1 , p-value of 1 ,
and R2 will be affected.
In the following, we use symbols with hat to denote the original values of estimation, and use symbols with
tilde to denote the new va
#problem 1
#a
library(alr4)
library(faraway)
data(ais)
fit=glm(Sex~RCC+WCC+Hc+Hg+Ferr+SSF+Bfat, data=ais, family=binomial)
summary(fit)
#b
#sex is purely binary data,
#so it is not appropriate to perform the lack of fit test
#c
predict(fit, newdata=data.f