Guest User

Untitled

a guest
Jan 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. pmethod <- function(theta=2){
  2. result <- c()
  3. for (j in seq(1,1000)){
  4. data <- c()
  5. for(i in seq(1,1000)){
  6. sample <- 2.07*rt(100,df=5) # sample from distribution where we estimated $theta$ which is 2.07
  7. est <- sqrt((3/500)*sum(sample^2))
  8. data <- c(data,est)
  9. }
  10. qq <- quantile(data,probs=c(0.025,0.975))
  11. if(theta >= qq[1] & theta <= qq[2]){
  12. t <- 1
  13. }else{
  14. t <-0
  15. }
  16. result <- c(result,t)
  17. }
  18. return(mean(result))
  19. }
  20.  
  21.  
  22. pmethod()
Add Comment
Please, Sign In to add comment