Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. m = 200000; n = 5; x = rnorm(m*n, 100, 15)
  2. DTA = matrix(x, nrow=m); a = rowMeans(DTA); s = apply(DTA, 1, sd)
  3. plot(a, s, pch=".", xlab="Sample Mean", ylab="Sample SD")
  4. t = (a-100)*sqrt(n)/s; t.crit = qt(.975, n-1); cond = (abs(t) > t.crit)
  5. points(a[cond],s[cond], pch=".", col="red")
  6. pm = c(-1,1); abline(v=100+pm*1.96*15/sqrt(n), col="darkgreen", lwd=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement