Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(224)
- e = rnorm(100, 0, 15); x = rnorm(100, 100, 15); y = x + e
- r.obs = cor(x, y); r.obs
- ## 0.6996899
- plot(x,y, pch=20)
- set.seed(218)
- B = 10000; f.re = numeric(B)
- for(i in 1:B) {
- ix = sample(1:100, 100, rep=T)
- r.re = cor(x[ix],y[ix])
- f.re[i] = r.re/r.obs }
- L.re = quantile(f.re, .025); U.re = quantile(f.re, .975)
- r.obs/U.re; r.obs/L.re
- 97.5%
- 0.6200286
- 2.5%
- 0.8262627
Add Comment
Please, Sign In to add comment