程序代写案例-ECO2008
时间:2021-05-05
Tutorial 7, Pen and Paper Exercises
ECO2008
Question 1
Let:
X =
 1 34 3
3 0

y =
 24
−1

(a) Calculate: X′y
(b) Calculate: y′y
(c) Calculate: X′X
(d) What are the dimensions (how many rows and columns) of the
matrix (X′X)−1X′y?
1
Question 2
You survey five people and gather data on their age, gender and
rating (out of 10) of a movie they have just seen. These data are
presented in Table 1.
Table 1: Movie Rating, Age and Gender
Gender Age Movie
Male 19 3
Female 35 6
Male 62 9
Male 42 8
Female 53 4
(a) Write down the matrix X where the following variables enter as
data vectors: Male (a dummy=1 if the observation is a male),
Age, and Movie.
(b) Use the formula: X¯ = (i′i)−1i′X to create a row vector of sample
means for these three variables. Remember, i is a vector of ones
with length equal to the number of observations n.
(c) Use the formula: Σˆ = (i′i−1)−1[(X− iX¯)′(X− iX¯)] to estimate
the sample variance-covariance matrix for these data.
(d) We are told that the following linear model exists between these
data:
Moviei = β1 + β2Agei + β3Malei + i.
Specify this regression in matrix form using the following nota-
tion:
y = Xβ + .
Maintaining the coefficient and variable order in the above,
clearly show where each of the variables enters in the equation.
2
Question 3
Let the data in Table 1 represent 5 observations from a 100 person
survey. In this 100 person survey the following coefficients corre-
sponding to the equation in Question 2 were fitted:
• βˆ1 = 8
• βˆ2 = −0.1
• βˆ3 = 1
(a) Bearing in mind there are 100 observations in the data set,
rewrite the previous linear equation in matrix form
y = Xβ + .
Maintaining the coefficient and variable order in the previous
question, clearly show where each of the variables enters in the
equation. You can use dots like:
y =
 y1...
yn

instead of writing out the full system in matrix form.
(b) If the dependent variable was multiplied by 100, so:
y =
 100×movie1...
100×movie100

and the model re-estimated, what would happen the estimated
coefficients βˆ?
(c) Use the estimated coefficients:
• βˆ1 = 8
3
• βˆ2 = −0.1
• βˆ3 = 1
to calculate the vector of predicted values: yˆ = Xβˆ, for the five
observations given in Question 2.
(d) Informed by your answer in part (c), calculate the vector of
residuals ˆ for the five observations shown in Question 2.
(e) Use the estimated model to predict the rating that a 10 year
old female would give this movie. If the youngest person in the
sample was 17 years of age, will this model provide an accurate
prediction?
4





















































































学霸联盟


essay、essay代写