Jon Shen Week 13 Tutorials: 1st June 2010
Jon Shen Week 13 Tutorials: 1st June 2010
Jon Shen Week 13 Tutorials: 1st June 2010
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
For example, x
1
= x, x
2
= x
2
or x
1
= e
x
, x
2
= ln x, x
3
= x
5
Determine E[
] and Var[
];
* Hypothesis tests:
i
= c for some constant c;
Calculate R
2
and adjusted R
2
;
http://www.actuaries.org.uk/students/exams/
preparing/exam_papers
1997-1999 - Subject C
Jon Shen Week 13 Tutorials
Summary
Exam Tips
Matrix Manipulation
Regression
Technique
1. READ THE QUESTION
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
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
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
= 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
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
=
_
_
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