Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. m = 10^5; n = 4; alp = 2
  2. x = rgamma(n*m, alp, 1)
  3. DTA = matrix(x, nrow=m, byrow=T)
  4. s = rowSums(DTA); u = DTA[,1]/s
  5. mean(u); var(u)
  6. ## 0.2506025 ## approximates E(U)
  7. ## 0.02084331 ## approximates V(U)
  8.  
  9. hist(u, prob=T, col="wheat", main="")
  10. curve(dbeta(x, alp, (n-1)*alp), n = 1001, lwd=2, col="blue", add=T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement