Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # true parameters
- gamma = 3
- beta = 1
- theta = -1
- delta = 2
- # explanatories
- x = rnorm(250)
- z = x * gamma + rnorm(250)
- # errors
- err = rnorm(250)
- # dgp1
- y = z * theta + x * beta + err
- lm(y ~ z + x - 1) # good estimate of theta
- # dgp2
- y = (z - x * gamma) * theta + x * beta + err
- lm(y ~ z + x - 1) # equivalent estimate of theta
- # dgp3
- y = z * theta + x * z * delta + x * beta + err
- lm(y ~ z + x + z * x - 1) # good estimates of theta and delta
- # dgp4
- y = (z - x * gamma) * theta + x * (z - x * gamma) * delta + x * beta + err
- lm(y ~ z + x + z * x - 1) # good estimate of theta, bad estimate of delta
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement