Linear Statistical Models, Quiz 1
(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]
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]
| 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]
1. Let $x$ and $y$ be vectors of integers. (i) Write an R code to check if the given two vectors, say $x$ and $y$, have the same length or not. [2 Marks] (ii) Write an R code to compute the dot product of two numeric vectors $x$ and $y$. [2 Marks] (iii) Write an R code to create a new vector containing only the even numbers from the vector $x$. [3 Marks] 2. Suppose $\vec{Y} = X\vec{\beta} + \vec{\epsilon}$ be a linear model, where $$\begin{aligned} \vec{Y} &= (y_1, y_2, y_3, \ldots, y_n)^T, \\ \vec{\beta} &= (\beta_1, \beta_2, \beta_3, \ldots, \beta_m)^T, \\ X &= ((x_{ij})) \;; 1 \leq i \leq n, 1 \leq j \leq m \end{aligned}$$ and $$\vec{\epsilon} = (\epsilon_1, \epsilon_2, \epsilon_3, \ldots, \epsilon_n)^T$$ where, $\vec{\epsilon}$ has mean $\vec{0}$ and variance covariance matrix $\sigma^2 I_{n \times n}$. (a) Define what is meant by $\hat{\vec{\beta}}$ is the least square estimate of $\vec{\beta}$? [3 Marks] (b) Show that any least square estimate $\hat{\vec{\beta}}$ of $\vec{\beta}$ satisfies: $$(X^T X)\hat{\vec{\beta}} = X^T \vec{Y}$$ [5 Marks] 3. 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 ($\vec{x}$) | Number of Goals ($\vec{y}$) | |---|---| | -1 | 4 | | 0 | 1 | | 1 | 3 | | 2 | 0 | (a) Draw a scatter plot of $(\vec{x}, \vec{y})$. [2 Marks] (b) Let $$X = \begin{pmatrix} 1 & -1 \\ 1 & 0 \\ 1 & 1 \\ 1 & 2 \end{pmatrix}$$ Suppose we assume the linear model $(\vec{y}, X\vec{\beta}, I_{5\times5})$ for the data. Find the least square estimate for $\vec{\beta}$. [4 Marks] (c) For the values of $\vec{\beta}$ obtained, draw the least square line on the graph above. [2 Marks] (d) Another analyst claim that the least square estimate for $\vec{\beta}$ is given by: $$\tilde{\vec{\beta}} = \hat{\vec{\beta}} + \begin{pmatrix} 1 \\ -1 \end{pmatrix}$$ where, $\hat{\vec{\beta}}$ is the least square estimate obtained in (c). Whose claim for least square estimate for $\vec{\beta}$ is correct and why? Elaborate [4Marks] (e) Estimate the value of $y$ when $x = 5, -2$. [3 Marks]