Question 1
- Let and be vectors of integers.
(i) Write an R code to check if the given two vectors, say and , have the same length or not. [2 Marks]
(ii) Write an R code to compute the dot product of two numeric vectors and . [2 Marks]
(iii) Write an R code to create a new vector containing only the even numbers from the vector . [3 Marks]
- Suppose be a linear model, where
and
where, has mean and variance covariance matrix .
(a) Define what is meant by is the least square estimate of ? [3 Marks]
(b) Show that any least square estimate of satisfies:
[5 Marks]
- An analyst wanted to predict the number of goals scored by a Canadian football club, for which he/she collected the following data:
| Temperature on match day () | Number of Goals () |
|---|---|
| -1 | 4 |
| 0 | 1 |
| 1 | 3 |
| 2 | 0 |
(a) Draw a scatter plot of . [2 Marks]
(b) Let
Suppose we assume the linear model for the data. Find the least square estimate for . [4 Marks]
(c) For the values of obtained, draw the least square line on the graph above. [2 Marks]
(d) Another analyst claim that the least square estimate for is given by:
where, is the least square estimate obtained in (c).
Whose claim for least square estimate for is correct and why? Elaborate [4Marks]
(e) Estimate the value of when . [3 Marks]
I have written answers on the answer sheets
Not applicable
