Professional Documents
Culture Documents
許湘伶
Applied Linear Regression Models
(Kutner, Nachtsheim, Neter, Li)
Bonderroni inequality:
b0 ± Bs{b0 } b1 ± Bs{b1 }
B = t(1 − α/4; n − 2)
Example (p.156)
Toluca company
α = 0.1; B = t(1 − 0.4/1; 23) = 2.069
8.20 ≤ β0 ≤ 116.5
2.85 ≤ β1 ≤ 4.29
toluca<-read.table("toluca.txt",header=T)
attach(toluca)
fitreg<-lm(Hrs~Size)
confint(fitreg)
confint(fitreg,level=1-alpha/2) # Bonferroni C.I.
Working-Hotelling procedure
Ŷh = b0 + b1 Xh
(Xh −X̄) 2
1
s{Ŷh } = MSE n +P(X −X̄)2
i
Xh Ŷh s{Ŷh }
30 169.5 16.96
65 294.4 9.918
100 419.4 14.27
fitreg<-lm(Hrs~Size)
Xh<-c(30,65,100)
pred<-predict.lm(fitreg,data.frame(Size = c(Xh)),
se.fit = T, level = 0.9)
W <-rep(sqrt( 2 * qf(0.90, 2, n-2) ),length(Xh))
rbind(pred$fit-W * pred$se.fit,pred$fit+W * pred$se.fit)
1 2 3
[1,] 131.1542 272.0351 387.1591
[2,] 207.7897 316.8229 451.6130
Bonferroni procedure
fitreg<-lm(Hrs~Size)
Xh<-c(30,65,100)
pred<-predict.lm(fitreg,data.frame(Size = c(Xh)),
se.fit = T, level = 0.9)
B=rep(qt(1-alpha/(2*length(Xh)),n-2),length(Xh))
rbind(pred$fit-B * pred$se.fit, pred$fit+B * pred$se.fit)
1 2 3
[1,] 131.0570 271.9783 387.0774
[2,] 207.8868 316.8797 451.6947
Ŷh ± Ss{pred}, S 2 = gF (1 − α; g, n − 2)
Xh<-c(80,100)
g<-length(Xh)
alpha<-0.05
CI.New <- predict.lm(fitreg,data.frame(Size = c(Xh)),
se.fit = T, level = 1-alpha)
M <-rbind(rep(qt(1 - alpha / (2*g), fitreg$df),g),
rep(sqrt( g * qf( 1 - alpha, g, fitreg$df)),g))
(a) g = 2 (b) g = 3
Yi = βi Xi + εi , εi ∼ N (0, σ 2 ) (4.10)
df : n − 1
hsuhl (NUK) LR Chap 4 24 / 45
Regression through Origin
b1 = 4.68527
Ŷ = b1 X
Yi = βi Xi + εi , εi ∼ N (0, σ 2 ) (4.10)
P 2
(Yi − Ȳ )2
P
SSE = e i may exceed SSTO =
Curvilinear
a linear pattern with an intercept away from the origin
SSE
⇒R2 = 1 − may turn out < 0
SSTO
⇒R2 has no clear meaning for regression through the origin.
Measure Errors:
The response variable: Y
no new problems are created when these errors are
uncorrelated and no biased
absorbed in the model error term ε
The predictor variable X
pressure in a tank
temperature in an oven
speed of a production line
Measurement Errors in X
Illustration:
Xi : the true age of the ith employee
Xi∗ : the age reported by the employee of the employment
record
Measurement Error δi :
δi = Xi∗ − Xi
Yi = β0 + β1 Xi + εi
Yi = β0 + β1 (Xi∗ − δi ) + εi (4.23)
⇒Yi = β0 + β1 Xi∗ + (εi − β1 δi ) (4.24)
E{δi } = 0
E{εi } = 0
E{δi εi } = 0
⇒ E{Xi∗ } = Xi
E{εi − β1 δi } = 0;
σ{Xi∗ , εi − β1 δi } = E{δi εi − β1 δi2 } = −β1 σ 2 {δi }
Berkson Model
Inverse Predictions
Two examples:
A trade association(夥伴關係) analyst: selling price Yh(new)
from another firm not belong to the trade association is
known ⇒ desired to estimate the cost Xh (new)
Y =the amount of decrease in cholesterol(膽固醇) level; X : a
given dosage of a new drug for 50 patients⇒ for a new
patient, Yh(new)
Inverse Predictions-Example
Medical
measuring low concentration of galactose(半乳糖) in the blood
12 sample;
X : known concentration; four different levels
Y : measured concentration
n = 12 b0 = −0.100 b1 = 1.017 MSE = 0.0272
(Xi − X̄ )2 = 135
X
s{b1 } = 0.0142 X̄ = 5.500 Ȳ = 5.492
Ŷ = −0.100 + 1.017X
H0 : β1 = 0 ⇒ Conclude β1 6= 0
Yh(new) = 6.52 ⇒ X̂h(new) = 6.509 ⇒ 6.13 ≤ Xh(new) ≤ 6.89
Choice of X Levels