
207Regression
We can do a nonintercept regression by adding 0 or −1 to the expression y ~ x to read y ~ 0 +x
or y ~ x − 1. Let us try
tox <- read.table(file=“lab6/test-RTO.txt”,header=T)
attach(tox)
tox.lm <- lm(Resp ~ 0 + Exp) # regression with 0 intercept
plot(Exp,Resp) # scatter plot
abline(a=0, b=tox.lm$coef) # add regression line to scatter plot
summary(tox.lm) # get more info on regression object
par(mfrow=c(2,2));plot(tox.lm) # diagnostic plots residual error
to get graphs in Figures 6.19 and 6.20.
0246
0
5
10
15
FIGURE 6.19 Regression through the origin.
0510 15
−1
1
2
Fitted values
Residuals
2
5
4
−1.5 −0.5 0.5 1.5
−1.0
0.5 ...