Simulate OLS
sim_ols.Rd
Simulate a y variable for an Ordinary Least Squares (OLS) regression.
Arguments
- u
an error vector
- xb
predicted x values as calculated by
make_xb()
Examples
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]])
#>
#> Call:
#> lm(formula = y ~ x[[1]])
#>
#> Coefficients:
#> (Intercept) x[[1]]
#> 1.253 1.898
#>