# Simulating new x's in regression simulation study

One of my homework problems is a simulation that compares three estimators (least squares, ridge regression with known parameters, and ridge regression with estimated parameters) for the following model $$Y_i = \beta X_i + \epsilon_i,\quad \epsilon_i\sim N(0,\sigma^2)$$

I am supposed to do 1000 replications with $X_i\sim N(0,2)$. Initially I generated my $X$ vector of data and used the same $X$ vector for each of the 1000 repetitions (so only thing different between repetitions is what random error gets added on).

Then I thought that might be wrong and that I should generate new $X$ data between each repetition.

What is the correct thing to do?

I can provide code if need be, but not really necessary to answer my question.

## 1 Answer

I think it makes sense to change X between iterations. But within an iteration you should have the same X to compare the three estimators.

You want to compare the three estimators in general. If you keep X constant, it could happen that an estimator that is not better in general performs better, because that particular X you chose turned out to have some special property.