Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. B = 10^5; n = 10; mu = 1000; sg = 1
  2. DTA = matrix(rnorm(B*n, mu, sg), nrow=B) # each row a sample of size n
  3. a = rowMeans(DTA) # vector of B sample means
  4. s = apply(DTA, 1, sd) # vector of B sample SDs
  5. rel.er.a = abs(a - mu)/mu; mean(rel.er.a)
  6. ## 0.0002509101 # estimated MAE(sample mean)
  7. rel.er.s = abs(s - sg)/sg; mean(rel.er.s)
  8. ## 0.1880363 # estimated MAE(sample SD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement