Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. x = 10/runif(10^5)^.5
  2. pm = sample(c(-1,1),10^5, rep=T)
  3. y = x*pm
  4. hist(y[abs(y) < 100], prob=T, br=50)
  5.  
  6. x1 = rexp(10^5, 1); x2 = rexp(10^5, 1)
  7. y = x1 - x2
  8. mean(y); var(y)
  9. [1] 0.006819823
  10. [1] 1.989892
  11. hist(y, prob=T, br=50, col="skyblue2")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement