I want to generate data in R to solve the following problem:
Consider the following Data Generating Process (DGP) $Y_i = β_0 + β_1 · X_i + β_2 · Z_i + u_i$ , where $β_0 = 0.75$, $β_1 = 0.50$ and $β_2 = 0.25$. Imagine that somebody wishes to obtain a proper (unbiased and consistent) estimate for $β_1$ and decides to estimate $Y_i = b_0 + b_1 · X_i + v_i$ , instead of the true DGP.
Write the R code to show that:
when Xi and Zi are uncorrelated, the OLS estimator for b1 is unbiased and consistent;
when Xi and Zi are positively correlated, the OLS estimator for b1 is upward biased and inconsistent;
when Xi and Zi are negatively correlated, the OLS estimator for b1 is downward biased and inconsistent.