PS1 Solutions
PS1 Solutions
PS1 Solutions
1 Question 1
Solution (1)
Solution (a) The population values are:
β0 21.14285714
β1 = 0.2619047619
β2 −0.0952380952
1
Solution (2)
Solution (a) The results have been saved inside the file “1 2 a.dta”.
E(β̂|X) = β =⇒ E(β̂|X) − β = 0
Since we cannot compute the conditional expectation of the OLS, we can use the
sample average that (by the weak law of large numbers) should approximate the
1 Pn ˆ
conditional expectation (as n → ∞, βk → E(β̂k |X)). The table that
n i=1 i
follows displays the sample averages of the estimates and the “sample bias”,
computed as the difference between the sample averages and the population’s
values.
Thus, the fact that the “sample bias” is small evidences the fact that the true
bias should be zero, hence βˆ0 , βˆ1 and βˆ2 should be unbiased.
Solution (c) As we can see from the graphs, the distributions of βˆ1 and βˆ2
are not normal. Nevertheless, they are not highly different from a normal. It
might be the case in which the central limit theorem holds, yet due to the
low quantity of observations (1000) the distributions are still not really smooth.
Solution (3)
Solution (a) Compared with the previous ones, the distributions of βˆ1 and
βˆ2 are really close to being normal this time. Thus, as we pointed out before,
that is probably cause by the fact that the CLT holds.
2
βˆ1 distribution βˆ2 distribution
2 Question 2
Solution (1)
Solution (a) We define the Least Square estimator as follows:
βb = (X ′ X)−1 X ′ Y
Where:
Y1 1 Temp1 Prec1
Y2 1 Temp2 Prec2
Y = . X = .
.. ..
.. .. . .
Yn 1 Tempn Precn
The estimates for Model 5 are presented below:
ˆ
β0 11830.78694
βb = βˆ1 = −214.3289192
βˆ2 −160.6549817
Solution (b) We define respectively the total sum of squares, the residual
sum of squares, and the explained sum of squares.
n
X
SST = (Yi − Ȳ ) · (Yi − Ȳ ) = 6522962196
i=1
Xn
SSR = (Ŷi − Ȳ ) · (Ŷi − Ȳ ) = 5782652519
i=1
Xn
SSE = (Yi − Ŷi ) · (Yi − Ŷi ) = 740309677.8
i=1
3
Solution (c) The R2 is a measure of the model goodness of fit: it indicates
how much of the dependent variables is explained by the indipendent variables
and it is defined as follows:
SSR
R2 = 1 − = 0.1134928665
SST
Solution (d) The fitted values and residuals are defined below:
Ŷ = X β̂
ê = Y − Ŷ
The residuals’ average is zero by construction, yet the result is not because of
the approximation error.
We can compute the sample covariance between the residuals and the re-
gressors using the short formula since ê¯ = 0:
Pn
1.62819 · 10−12
i=1 êi
1 ′ 1 n
X ê = Pi=1 Tempi · êi = 1.72588 · 10−10
P
n n n
i=1 Preci · êi 4.47751 · 10−11
As expected the results tend to zero as the Xs and the residuals are orthogonal
by construction (so their value is actually zero).
By construction this difference is zero, yet the computation does not return zero
due to STATA’s approximation error.
4
Solution (2)
Solution (a) The table presents the results obtained using MATA and the
ones obtained using STATA.
MATA STATA
βˆ0 11830.78694 11830.79
βˆ1 -214.3289192 -214.3289
βˆ2 -160.6549817 -160.655
As we can see, the results are the same, except for the negligible decimal ap-
proximation.
Solution (b) The average fitted value is 6031.944 and the average value of Yi
is 6031.944. Indeed, they are exactly the same.
The first observation is underpredicted (the predicted value is 6871.649,
while the value is 13080.423), whereas the second observation is overpredicted
(the predicted value is 9408.199, while the value is 8378.71).
Solution (c) We show that the sample average of the OLS residuals is equal
to zero by computing it on STATA.
n
1X
ê¯ = eˆi = 4.13 · 10−6
n i=1
Solution (3)
Solution (a) We expect β˜1 to be biased, because since the true model is
Yi = β0 + β1 Tempi + β2 Preci + ϵi
Solution (b) We obtain βˆ1 equal to -214.3289 and β˜1 equal to -275.5626. We
expect them to be very similar:
• When Preci and Tempi are weakly correlated (we expect them to be equal
when the two variables are uncorrelated).
• When β2 is close to zero (if β2 is exactly equal to zero, then β˜1 = βˆ1 ).
5
Solution (c) The estimate for Model 6 was β˜1 equal to -275.563. The par-
tialling out steps for the same Model will be:
1. Regress Yi on the constant:
Yi = α̂ + uˆ1
Tempi = γ̂ + uˆ2