Guest User

Untitled

a guest
Jul 15th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. set.seed(715) # retain for exactly same simulation, delete for fresh run
  2. m = 10^6; n = 5; mu = 0; sg = 4
  3. x = rnorm(m*n, mu, sg); MAT = matrix(x, nrow = m)
  4. v = rowMeans((MAT - mu)^2) # using 'known' population mean
  5. mean(v); mean((v-sg^2)^2)
  6. [1] 15.99998 # aprx E(V) = 16
  7. [1] 102.5 # aprs MSE(V) = 102.4
  8.  
  9. hist(5*v/sg^2, prob=T, br=40, xlab="q", col="skyblue2", main="")
  10. curve(dchisq(x, 5), add=T, lwd=2, n=1001)
Add Comment
Please, Sign In to add comment