Guest User

Untitled

a guest
May 18th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.46 KB | None | 0 0
  1. #!/usr/bin/R
  2. #first execute in shell: links2 -dump http://www.reddit.com/r/Ingress/comments/25um5v/lets_create_capsule_hacks_statistics/|grep '[0-9]/[0-9]'|sed -e 's/^[^0-9]*//' -e 's/ .*//' -e 's/\([0-9/]\+\).*/\1/'|grep '[0-9]/[0-9]' >dat
  3. read.table("dat",sep="/")->X
  4. probb=function(x,p) {dbinom(x=x[[1]],size=x[[2]],prob=p)}
  5. MLE=function(p) prod(apply(X,1,function(x) probb(x,p)))
  6. q=(1:300)/100000
  7. plot(q,sapply(q,MLE))
  8. print(q[which.max(sapply(q,MLE))])
Add Comment
Please, Sign In to add comment