Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. m= 10^6; n = 5; x = y = numeric(m)
  2. for (i in 1:m) {
  3. t = rnorm(n); t.max = max(t)
  4. new = rnorm(3)
  5. x[i] = sum(new > t.max) # nr new above t.max
  6. y[i] = sum(diff(c(t.max, new) > 0)) } # 3 means incr from t.max on
  7. mean(x == 3); mean(y == 3)
  8. ## 0.017736 # aprx prob all 3 new exceed max of 5 historical
  9. ## 0 # aprx prob max.t < t.6 < t.7 < t.8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement