Академический Документы
Профессиональный Документы
Культура Документы
Shobhana Stoyanov
Department of Statistics
UC Berkeley
December 5, 2013
Shobhana Stoyanov
1 / 36
Shobhana Stoyanov
2 / 36
3 / 36
4 / 36
70
65
60
75
60
65
70
75
5 / 36
70
65
60
75
60
65
70
75
6 / 36
75
70
65
60
80
60
65
70
75
80
7 / 36
60
65
son
70
75
60
65
70
75
father
Shobhana Stoyanov
8 / 36
60
65
son
70
75
60
65
70
75
father
Shobhana Stoyanov
9 / 36
Shobhana Stoyanov
10 / 36
y=
y=
0e
1x
1x
2x
is a linear model
is a nonlinear model
Shobhana Stoyanov
11 / 36
1 xi
+ ei , i = 1, . . . , n
Our assumptions
2
ei N(0,
0,
1,
), ei are iid
1 xi ,
Y N(
,
1x
Shobhana Stoyanov
2 ),
1x
2 /n)
12 / 36
Estimating
Let S( 0 ,
and
1) =
n
X
(Yi
2
1 xi )
i=1
1 x
1,
x)Yi
=
x)2
(x
x)(Yi
i=1
Pn i
x)2
i=1 (xi
Y )
(Why?)
13 / 36
Shobhana Stoyanov
E ( 0 ) =
0,
and E ( 1 ) =
14 / 36
Var ( 1 ) =
Cov ( 0 , 1 ) =
Shobhana Stoyanov
Pn
Pn
x
i=1
Pni
( i=1 xi )2
2
i=1 xi
Pn
2
i=1 xi
Pn
2
i=1 xi
P
( ni=1 xi )2
Pn
x
i=1
Pni
( i=1 xi )2
15 / 36
n
X
(xi
x)
x)Yi
x)2
(Note that
i=1
) 1 =
Pn
n
X
i=1
i=1 ai Yi
) Var ( 1 ) =
Shobhana Stoyanov
= Pn
i=1 (xi
x)2
16 / 36
ai2 = A.)
17 / 36
and
1.
Shobhana Stoyanov
18 / 36
Regression assumptions
19 / 36
More about 1
If Yi N(
0+
1 xi ,
), then 1 N( 1 ,
/A) where A =
n
X
(xi
i=1
Shobhana Stoyanov
20 / 36
x)2
Inference about
need to estimate
need n
2) as an estimate for
n
X
(ei )2 where
i=1
Use s 2 = RSS/(n
p 1
/ A
Shobhana Stoyanov
21 / 36
Inference about
s 1 =
Then t =
s 1
RSS
1
s
p = pPn
n 2
A
i=1 (xi
has the tn
x)2
distribution.
We can build a (1
Shobhana Stoyanov
22 / 36
Inference about
t=
= 0 vs H1 :
6= 0 using
s 1
If we reject the null, then we can conclude that x has some predictive
value. That is, there exists a linear relationship between x and Y .
Shobhana Stoyanov
23 / 36
1 x0 ?
Can we
Note that the first question is about a mean value, and the second
about single value.
Shobhana Stoyanov
24 / 36
1 x0
= 0 ,
) Var (0 ) =
x)
x))
1
(x0 x)2
+ Pn
n
x)2
i=1 (xi
If x0 is far from x, then this variance is large, and the accuracy of the
estimate decreases.
Shobhana Stoyanov
25 / 36
A 100(1
0 t 2 ,n
Shobhana Stoyanov
1 (x0 x)2
+
n
A
26 / 36
Prediction intervals
We now want to predict a single observed value Y0 , given a value x0 .
We know that the fitted value Y0 is given by 0 + 1 x0 = 0 .
The value of the response is the sum of the value of the true line and
the error.
Y0 =
N(0,
0+
2 ).
1 x0 +
Shobhana Stoyanov
27 / 36
Prediction intervals
Var (Y0 ) = Var (0 ) +
) Var (Y0 ) =
A 100(1
1
(x0 x)2
+ Pn
+1
n
x)2
i=1 (xi
0 t 2 ,n
Shobhana Stoyanov
2s
1 (x0 x)2
+
+1
n
A
28 / 36
60 65 70 75
Son's height
60
65
70
75
Father's height
Shobhana Stoyanov
29 / 36
Define sxx
1X
=
(xi
n
x) and syy
i=1
1X
=
(Yi
n
Y )2
i=1
1X
(xi
n
x)(Yi
Y )
i=1
Note that 1 =
r
syy
=r
sxx
Pn
(x
x)(Yi
i=1
Pn i
x)2
i=1 (xi
Y )
p
r sxx syy
sxy
=
sxx
sxx
Regression to mediocrity
Shobhana Stoyanov
30 / 36
0 = Y
and
1 = r
1 x
r
syy
sxx
Y Y =r
(x
sxx
x)
31 / 36
32 / 36
33 / 36
Regression Diagnostics
Please refer to Philip Starks online text: SticiGui if you would like
more details.
Shobhana Stoyanov
34 / 36
From the summary, we can see that least squares estimates are about:
1 = 39.87 and 0 = 26068
SE ( 1 ) = 0.5042 and SE ( 0 ) = 16.17. What about estimating
The Residual standard error in the summary gives us s, where
RSS
s2 =
is our estimate of 2 . Our estimate of is 25.31.
n 2
Shobhana Stoyanov
35 / 36
2?
Regression in R
We now have the equation of the regression line:
26068(16.17)
39.87(0.5042) temperature
36 / 36