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