Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(5)
- N = 500
- b0 = 3
- b1 = .4
- s2 = 5
- g1 = 1.5
- g2 = .015
- x = runif(N, min=0, max=100)
- y_homo = b0 + b1*x + rnorm(N, mean=0, sd=sqrt(s2 ))
- y_hetero = b0 + b1*x + rnorm(N, mean=0, sd=sqrt(exp(g1 + g2*x)))
- mod.homo = lm(y_homo~x)
- mod.hetero = lm(y_hetero~x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement