Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # An R script to visualize the sales trajectory of Paratek's Nuzyra
- #
- # (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
- Sys.setlocale("LC_TIME", "C")
- a <- seq(as.Date("2019/09/13"),as.Date("2020/04/10"), "week")
- m <- seq(as.Date("2019/06/01"),as.Date("2020/01/01"), "month")
- a <- as.Date(a, "%Y/%m/%d")
- # Date are for the actual scripts date,
- # not the report date, that's a week after.
- # e.g. report for 2020/01/03 below was published 2020/01/10
- b <- c(
- 13,18,22, # end of Q3
- 26,24,24,33,22,25,26,31,19,27,37,29,
- 25, #### no report for 2019/12/27
- 23, # 2020/1/3
- 32,29,41,40,
- 43, # 2020/2/7
- 44,32,43,
- 47, # 2020/3/6
- 41,43,53,
- 43, # 2020/4/3
- 30
- )
- ## Monthly TRX - Approx. $ per script: 7500
- ##
- ## Ju 29
- ##
- ## Jul 53
- ## Aug 77
- ## Sep 77
- ##
- ## Oct 113
- ## Nov 108
- ## Dec 118
- ##
- ## Jan 158
- ## Feb 168
- ## Mar 205
- ## Institutional data ($)
- ## Ju 248.41k
- ##
- ## Jul 448.34k
- ## Aug 390.38k
- ## Sep 833.84k
- ##
- ## Oct 805.32k
- ## Nov 1.20M
- ## Dec 883.56k
- ##
- ## Jan 853.73k
- ## Feb
- ## Mar
- inst <- c(248410, 448340, 390380, 833840, 805320, 1200000, 883560, 853730)
- e <- data.frame(a,b)
- names(e) <- c("Week", "Scripts")
- f <- data.frame(m,inst)
- names(f) <- c("Month", "Dollars")
- t = length(a)-1
- cwgr = ( ((b[t]+b[t+1])/2) / b[1] )^(1/t)-1
- t_m = length(m)-1
- cmgr_i = ( ((inst[t_m]+inst[t_m+1])/2) / inst[1] )^(1/t_m)-1
- cqgr = (cwgr+1)^13 -1
- cqgr_i = (cmgr_i+1)^3 -1
- q419 <- head(tail(b,-3),13)
- q120 <- head(tail(b,-16),13)
- q220 <- head(tail(b,-29),13)
- message("Retail Scripts Q4/19: ", sum(q419), " Q1/20: ", sum(q120), " Q2/20: ", sum(q220))
- message("Weekly Mean Q4/19: ", round(mean(q419),1), " Q1/20: ", round(mean(q120),1), " Q2/20: ", round(mean(q220),1))
- message("QoQ Weekly Mean Growth: Q4-Q1: ", round((((mean(q120)-mean(q419)))/mean(q419))*100, 1), "% Q1-Q2: ",
- round((((mean(q220)-mean(q120)))/mean(q120))*100, 1), "%")
- png("nuzyra_retail.png",width=480,height=480)
- plot(Scripts ~ Week, e, type = 'l', col='blue',main="Nuzyra Weekly Retail Scripts", sub=paste0("Compounded Weekly Growth Rate: ", round(cwgr*100, 1), "%"), col.sub='red')
- dev.off()
- png("nuzyra_inst.png",width=480,height=480)
- plot(Dollars ~ Month, f, type = 'l', col='blue',main="Nuzyra Institutional", sub=paste0("Compounded Monthly Growth Rate: ", round(cmgr_i*100, 1), "%"), col.sub='red')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement