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