Advertisement
Spartrap

Monthly Copiktra scripts vs. geometric progression

Nov 25th, 2019
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.68 KB | None | 0 0
  1. #
  2. # An R script to visually compare the monthly growth trajectory of medical scripts
  3. # for Verastem's Copiktra to a given geometric progression (a Compounded Monthly Growth Rate)
  4. #
  5. # (c) 2019 Germain Garand <germain.garand@laposte.net>
  6. #
  7. # This is for information purposes only. Any calculation performed herein could be
  8. # wrong and/or misrepresent reality. Use at your own risk.
  9. #
  10. # License: Creative Commons BY-NC 2.0
  11. #
  12. # Version 0.02
  13. #
  14. # History:
  15. #   0.01 - 2019/11/26- .initial version
  16. #   0.02 - .fix geometric progression starting at n+1 instead of n (^0)
  17. #          .fix ylim of geometric plot (must take max of a, not the tail)
  18. #          .round geometric values on axis for prettier display
  19. #
  20.  
  21. # common ratio of the geometric progression to use as comparator
  22. geom_ratio <- 1.18
  23.  
  24. # Monthly Copiktra scripts data (insto+retail)
  25. ###  Not sure how trustable those informations are. Please double check!
  26. a <- c(18, 33, 61, 69, 52, 71, 76, 94, 89, 116, 118, 157, 132)
  27. c <- c(1:length(a))
  28. b <- 18*geom_ratio**(0:(length(a)-1))
  29.  
  30. message("Geometric progression: ", paste(round(b), " "))
  31.  
  32. e <- data.frame(c,a,b)
  33. names(e) <- c("Month", "Scripts", "Geometric")
  34.  
  35. p <- (geom_ratio-1)*100
  36.  
  37. png("copiktra_scripts.png", width=480, height=480)
  38. plot(Scripts ~ Month, e, type = 'l', col='blue', main=paste("Copiktra scripts vs.", geom_ratio, "(",p,
  39.      "% CMGR) Geometric progression", sep=''), ylab="Scripts")
  40. par(new=TRUE)
  41. plot(Geometric ~ Month, e, type='l', ylim=c(head(a,1),max(a)),axes=FALSE, ann=FALSE,col='violet')
  42. axis(4, round(e$Geometric), col='violet', col.axis='violet')
  43. legend("top", inset=.05, c("Copiktra scripts","Geometric reference"), fill=c("blue","violet"))
  44. dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement