To complete this exercise you need a software package that allows you to generate data from the uni-

form and normal distributions.

$(i)$ Start by generating 500 observations on $x_{r}$ -the explanatory variable - from the uniform dis-

tribution with range $[0,10]$ . (Most statistical packages have a command for the Uniform( $0,1 )$

distribution; just multiply those observations by $10 .$ ) What are the sample mean and sample

standard deviation of the $x_{i}$ ?

$(ii)$ Randomly generate 500 errors, $u_{i},$ from the Normal(0,36) distribution. (If you generate a

Normal( $(0,1),$ as is commonly available, simply multiply the outcomes by six.) Is the sample ave

erage of the $u_{i}$ exactly zero? Why or why not? What is the sample standard deviation of the $u_{i} ?_{i} ?$

$\begin{aligned} \text { (iii) Now generate the } y_{i} \text { as } & \\ & y_{i}=1+2 x_{i}+u_{i} \equiv \beta_{0}+\beta_{1} x_{i}+u_{i} \end{aligned}$

$\begin{array}{l}{\text { that is, the population intercept is one and the population slope is two. Use the data to run the }} \\ {\text { regression of } y_{i} \text { on } x_{i} \text { . What are your estimates of the intercept and slope? Are they equal to the }} \\ {\text { population values in the above equation? Explain. }}\end{array}$

$\begin{array}{l}{\text { (iv) Obtain the OLS residuals, } \hat{u}_{i} \text { , and verify that equation }(2.60) \text { holds (subject to rounding error) }} \\ {\text { (v) Compute the same quantities in equation }(2.60) \text { but use the errors } u_{i} \text { in place of the residuals. }} \\ {\text { Now what do you conclude? }}\end{array}$

$\begin{array}{l}{\text { (vi) Repeat parts (i), (ii), and (iii) with a new sample of data, starting with generating the } x_{F} \text { Now }} \\ {\text { what do you obtain for } \hat{\beta}_{0} \text { and } \hat{\beta}_{1} ? \text { Why are these different from what you obtained in part (iii)? }}\end{array}$