Guest User

Untitled

a guest
Feb 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. set.seed(224)
  2. e = rnorm(100, 0, 15); x = rnorm(100, 100, 15); y = x + e
  3. r.obs = cor(x, y); r.obs
  4. ## 0.6996899
  5. plot(x,y, pch=20)
  6.  
  7. set.seed(218)
  8. B = 10000; f.re = numeric(B)
  9. for(i in 1:B) {
  10. ix = sample(1:100, 100, rep=T)
  11. r.re = cor(x[ix],y[ix])
  12. f.re[i] = r.re/r.obs }
  13. L.re = quantile(f.re, .025); U.re = quantile(f.re, .975)
  14. r.obs/U.re; r.obs/L.re
  15. 97.5%
  16. 0.6200286
  17. 2.5%
  18. 0.8262627
Add Comment
Please, Sign In to add comment