Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- B = 10^5; n = 10; mu = 1000; sg = 1
- DTA = matrix(rnorm(B*n, mu, sg), nrow=B) # each row a sample of size n
- a = rowMeans(DTA) # vector of B sample means
- s = apply(DTA, 1, sd) # vector of B sample SDs
- rel.er.a = abs(a - mu)/mu; mean(rel.er.a)
- ## 0.0002509101 # estimated MAE(sample mean)
- rel.er.s = abs(s - sg)/sg; mean(rel.er.s)
- ## 0.1880363 # estimated MAE(sample SD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement