Guest User

Untitled

a guest
Jun 11th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. The nested loop is producing this error: Non-numeric argument to mathematical function
  2. library(emdbook)
  3.  
  4. prev<-read.delim("shape.txt", header=T)
  5. shape1<-prev$shape1
  6. shape1<-as.numeric(shape1)
  7. shape2<-prev$shape2
  8. shape1<-as.numeric(shape2)
  9.  
  10. pvec <- seq(0, 1, length=298)
  11.  
  12. postvec<-data.frame(posterior=1:298)
  13. dim(postvec)
  14.  
  15. for (i in 1:length(shape1))
  16. {
  17. for (j in 1:length(shape2))
  18. {
  19. postvec[i]<- dbeta(pvec, shape1= shape1[i], shape2=shape2[j])
  20. }
  21. }
  22.  
  23. prev<-read.delim("shape.txt", header=T)
  24. shape1<-prev$shape1
  25. shape1<-as.numeric(shape1)
  26. shape2<-prev$shape2
  27. shape1<-as.numeric(shape2)
  28.  
  29. shape2<-as.numeric(shape2)
Advertisement
Add Comment
Please, Sign In to add comment