Learn R Programming

spdgp (version 0.1.0)

sim_ols: Simulate OLS

Description

Simulate a y variable for an Ordinary Least Squares (OLS) regression.

Usage

sim_ols(u, xb)

Value

A numeric vector

Arguments

u

an error vector

xb

predicted x values as calculated by make_xb()

References

spreg.dgp.dgp_ols

Examples

Run this code
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