Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #navigator 2.0 by organofcorti is licensed under a Creative Commons Attribution 3.0 Unported License.
- #written in R (www.r-project.org)
- #finds the c
- #very simple, reliable, but slow
- #estimated c value here:
- ctest<-300
- #how far above and below ctest to test:
- test<-5
- #can increase accuracy1&2 if you decrease test
- #or decrease accuracy1&2 if you increase test
- accuracy1<-0.01
- accuracy2<-0.1
- #most recent webpage updates here
- #can edit code to scrape
- #make sure round is early enough that
- #no renormalising has occurred
- #data here from 2011-10-08 10:36:16 UTC
- shares<-176520
- currentScore<-543196.9628
- currentSecs<-9*60+43
- sharesPerSec<-shares/currentSecs
- #calculates score for each c under investigation
- summary<-matrix(0,(2*test+1),3)
- i<-0
- for(c in (ctest-test):(ctest+test)){
- i<-i+1
- score<-exp((1/sharesPerSec)/c)
- k<-1;while(k<=shares) {k<-k+1;score<-score+exp((k/sharesPerSec)/c)}
- summary[i,1]<-c
- summary[i,2]<-score
- summary[i,3]<-abs(log(summary[i,2]/currentScore))
- if(summary[i,3]>accuracy){print(noquote(paste("Testing c=",c,", testing score is",trunc(score),", log ratio is",round(summary[i,3],digits=3))))}
- else{print(noquote(paste("Testing c=",c,", testing score is",trunc(score),", log ratio is",round(summary[i,3],digits=3),"GOOD ESTIMATE")))}
- }
- #the cell in col 3 closest to 0 corresponds
- #with the c value closest to the actual c
- if(min(summary[,3])<=accuracy2){print(noquote(paste("Best estimate, c=",summary[order(summary[,3]),1][1])))} else {
- if(summary[order(summary[,3]),1][1]<(c-test)){print(noquote("c is less than your minimum test range"))} else {
- if(summary[order(summary[,3]),1][1]>(c-test)){print(noquote("c is more than your maximum test range"))}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment