I just started learning regression, so my background is not very strong. I have to solve a certain problem, which doesn't seem too hard, however I have some trouble in understanding it.

Suppose we define

x<-seq(1,50,1), y<-3*x+2+6*rnorm(length(x))

Hence my response $Y$ is exactly of this type: $Y=X\beta+\epsilon$, where $\epsilon$ is the error and normally distributed (here with mean 0 and variance 1). Now we should do a simple linear regression $n$ times and saving the $n$ slopes of the regression.

reg <-lm(y~x)

The true value of the slope should be $3$, as assumed. I calculated the $n$ slopes and saved them in a vector $s$. The next task is to draw a histogram of the $n$ estimated slopes and add the normal density of the theoretically true distribution of the slopes. Here my problem starts: it is clear that the slopes are normally distributed. Hence I have to calculate the mean and variance. Looking at the model: $y_i=\beta_1+x_{i,2}\beta_2 +\epsilon_i$, where $\epsilon_i\sim\mathcal{N}(0,6^2)$. The hint is to use solve for the inverse of a matrix. I do not see how this should help? Is it meant, that I should calculate this:


How do I get from there the mean and variance? And what is the difference to the mean and empirical standard deviation of the estimated slopes? Thanks in advance for your help.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.