powered by
Simulate a y variable for an Ordinary Least Squares (OLS) regression.
sim_ols(u, xb)
A numeric vector
an error vector
predicted x values as calculated by make_xb()
make_xb()
spreg.dgp.dgp_ols
u <- make_error(50, method = "normal") x <- make_x(50) xb <- make_xb(x, c(1,2)) y <- sim_ols(u, xb) lm(y ~ x[[1]])
Run the code above in your browser using DataLab