Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Jon Shen Week 13 Tutorials: 1st June 2010

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

Summary

Exam Tips
Matrix Manipulation
Regression
Jon Shen Week 13 Tutorials
1st June 2010
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Summary

Multiple Regression: Fit y =


0
+
1
x
1
+
2
x
2
+ . . . to data

For example, x
1
= x, x
2
= x
2

or x
1
= e
x
, x
2
= ln x, x
3
= x
5

The equation is linear in the coecients

Know how to:

Express a given linear model in matrix-vector form;

* Obtain least squares estimates if given relevant matrices;

Determine E[

] and Var[

];

* Hypothesis tests:
i
= c for some constant c;

* Determine condence intervals for


i
;

Calculate R
2
and adjusted R
2
;

Construct an ANOVA table for the regression;

Interpret the coecients

* Determine a condence intervals for the mean Y value or a


prediction interval for the individual Y value corresponding to
a given x value (see PASS questions);
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Consultation

Week 13: 4-5pm today in Quad2061

Week 13: 6pm+ today?

Week 13: Thursday 11-1 via email / www.scriblink.com

Stuvac/Exam period: email - slow reply before June 17th

Exam period: 17/18th June: In person consultation at uni


Quad2061 (email to arrange appointment)

Exam period: 17/18th June: Online consultation via email /


www.scriblink.com
j.shen@unsw.edu.au
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Preparation
1. FORMULA BOOK! Know whats in here.
2. Starting point: lecture slides and tutorial problems
3. Revise class quizzes! (Quiz 1 Q5 and Quiz 2 Q4...)
4. Past Quizzes/Final exams
5. PASS questions - extra revision
6. IAA papers - even more revision

http://www.actuaries.org.uk/students/exams/
preparing/exam_papers

2005-2009 - CT3 (most relevant)

2000-2004 - Subject 101

1997-1999 - Subject C
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Technique
1. READ THE QUESTION

Understand what is being asked - highlight key words


2. Demonstrate that you understand the material

If short on time, indicate how you would attempt to solve the


problem
3. Do questions you are most condent with rst, and look at
the number of marks allocated
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Properties

Multiplication:
_
a b
c d
_
. .
across
_
f g
h k
_
. .
down
=
_
af + bh ag + bk
cf + dh cg + dk
_

Dierentiation:

T
X
T
Y = X
T
Y and

(X
T
Y)
T
= X
T
Y

T
X
T
X = 2X
T
X

Expectation: If B is random and A is non-random, then

E[AB] = AE[B]

Var[AB] = AVar[B]A
T
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3
Linear Model
Consider the model y =
3
_

0
+
1
x +
2
x
2
1. Is this a linear model? If not, explain how you can transform
it into a linear model.
2. Write the (transformed) model in matrix form.
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3
Linear Model - Solution
1. y
3
=
0
+
1
x +
2
x
2
2. Y = X + where
Y =
_
_
_
_
_
_
_
_
y
3
1
y
3
2
.
.
.
y
3
n
_
_
_
_
_
_
_
_
, X =
_
_
_
_
_
_
1 x
1
x
2
1
1 x
2
x
2
2
. . .
. . .
1 x
n
x
2
n
_
_
_
_
_
_
, =
_
_

2
_
_
, =
_
_
_
_
_
_
_
_

2
.
.
.

n
_
_
_
_
_
_
_
_
,
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3

and ANOVA Table


You decide to t the model from the previous slide to data. You
have 103 data points and are given that
(X
T
X)
1
= 10
6
_
_
38580 2237 1040
2237 230 34
1040 34 223
_
_
and
X
T
Y =
_
_
7651.72
91333.60
53992.96
_
_
.
Also

123
i =1
y
2
i
= 501813.55,

123
i =1
y
2
i
= 500881.11, y = 62.21.
a) Determine the least squares estimates

.
b) Construct an ANOVA table for this model, and hence calculate
the R
2
and adjusted R
2
.
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3

and ANOVA Table - Solution


a)

= (X
T
X)
1
X
T
Y
Using matrix multiplication:

= 10
6
_
_
38580 2237 1040
2237 230 34
1040 34 223
_
_
_
_
7651.72
91333.60
53992.96
_
_
= 10
6
_
_
38580 7651.72 2237 91333.60 1040 53992.96
2237 7651.72 + 230 91333.60 34 53992.96
1040 7651.72 34 91333.60 + 223 53992.96
_
_
= 10
6
_
_
34737416
2054069.72
977298.88
_
_
=
_
_
34.737416
2.05406972
0.97729888
_
_
=
_
_

2
_
_
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3

and ANOVA Table - Solution


b) N.B. The notation used here is slightly dierent from the
notation used in calculating ANOVA tables elsewhere.
SST =

123
i =1
y
2
i
n( y)
2
= 501813.5512362.21
2
= 25793.2057
SSR =

y
2
i
n( y)
2
= 500881.11 123 62.21
2
= 24860.7657
There are 123 data points and 3 regression parameters (s)
Hence, the total degrees of freedom is 123 - 1 = 122, and the
regression degrees of freedom is 3 - 1 = 2.
This gives us the following entries in the table:
Source df SS MS = SS/df F-Stat
Regression 2 24860.7657
25793.2057
2
= 12896.60285 ?
Error ? ? ?
Total 122 25793.2057
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3

and ANOVA Table - Solution


b) We can ll in the second row of the table:
122 - 2 = 120
25793.2057 - 24860.7657 = 932.44
932.44
120
= 7.7703
Source df SS MS = SS/df F-Stat
Regression 2 24860.7657 12896.60285 ?
Error 120 932.44 7.7703
Total 122 25793.2057
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3

and ANOVA Table - Solution


b) Finally, you can calculate the F-statistic:
12896.60285
7.7703
= 1659.723244
Source df SS MS = SS/df F-Stat
Regression 2 24860.7657 12896.60285 1659.723244
Error 120 932.44 7.7703
Total 122 25793.2057
R
2
=
SSR
SST
=
24860.7657
25793.2057
= 0.963849395
R
2
a
= 1
MSE
SST
n1
= 1
122 7.7703
25793.2057
= 0.963247042
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3
Hypothesis Testing and Condence Interval
From the previous slides, you have calculated

=
_
_
34.74
2.05
0.98
_
_
, (X
T
X)
1
= 10
6
_
_
38580 2237 1040
2237 230 34
1040 34 223
_
_
You have also constructed the ANOVA table
Source df SS MS = SS/df F-Stat
Regression 2 24860.77 12896.60 1659.72
Error 120 932.44 7.77
Total 122 25793.21
a) Determine a 95% condence interval for
2
.
b) Test the hypothesis H
0
:
1
= 2 against H
1
:
1
> 2 at 1%
signicance.
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3
Hypothesis Testing and Condence Interval - Solution
We need estimates of

Var[
1
] and

Var[
2
].
From slide 8, Var[

] =
2
(X
T
X)
1
.

2
is unknown, so we estimate this with s
2
= MSE = 7.77 from
the ANOVA table.
Then our estimate is 7.77 10
6
_
_
38580 2237 1040
2237 230 34
1040 34 223
_
_
In particular, we want

Var[
1
] = 7.77 10
6
230 = 0.0017871
and

Var[
2
] = 7.77 10
6
223 = 0.00173271
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3
Hypothesis Testing and Condence Interval - Solution
a) We have

2
_

Var[
2
]
t
np
= t
1233
= t
120
Then
Pr
_
_
1.98

2
_

Var[
2
]
1.98
_
_
= 0.95
Pr
_
1.98
0.98
2

0.00173271
1.98
_
= 0.95
Pr (0.89758085
2
1.06241915) = 0.95
So a 95% condence interval for
2
is (0.89758085, 1.06241915)
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Example 1
Example 2
Example 3
Hypothesis Testing and Condence Interval - Solution
b) H
0
:
1
= 2 against H
a
:
1
> 2
Under the null, the test statistic is

1
2
_

Var[
1
]
=
2.05 2

0.0017871
= 0.002113705
This is a one-sided test. The 99th quantile for a t
120
distribution is
2.358. The observed value of 0.002113705 is less than the
theoretical value of 2.358, so fail to reject the null as there is
insucient evidence to suggest that
1
is signicantly dierent
from two.
Jon Shen Week 13 Tutorials

You might also like