Advertisement
Spartrap

Nuzyra

Mar 27th, 2020
2,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 2.64 KB | None | 0 0
  1. #
  2. # An R script to visualize the sales trajectory of Paratek's Nuzyra
  3. #
  4. # (c) 2019 Germain Garand <germain.garand@laposte.net>
  5. #
  6. # This is for information purposes only. Any calculation performed herein could be
  7. # wrong and/or misrepresent reality. Use at your own risk.
  8. #
  9. # License: Creative Commons BY-NC 2.0
  10.  
  11. Sys.setlocale("LC_TIME", "C")
  12.  
  13. a <- seq(as.Date("2019/09/13"),as.Date("2020/04/10"), "week")
  14. m <- seq(as.Date("2019/06/01"),as.Date("2020/01/01"), "month")  
  15.  
  16. a <- as.Date(a, "%Y/%m/%d")
  17.  
  18. # Date are for the actual scripts date,
  19. # not the report date, that's a week after.
  20. # e.g. report for 2020/01/03 below was published 2020/01/10
  21. b <- c(
  22.      13,18,22, # end of Q3
  23.      26,24,24,33,22,25,26,31,19,27,37,29,
  24.      25, #### no report for 2019/12/27
  25.      23, # 2020/1/3
  26.      32,29,41,40,
  27.      43, # 2020/2/7
  28.      44,32,43,
  29.      47, # 2020/3/6
  30.      41,43,53,
  31.      43, # 2020/4/3
  32.      30
  33. )
  34.  
  35. ## Monthly TRX - Approx. $ per script: 7500
  36. ##
  37. ## Ju    29
  38. ##
  39. ## Jul   53
  40. ## Aug   77
  41. ## Sep   77
  42. ##
  43. ## Oct  113
  44. ## Nov  108
  45. ## Dec  118
  46. ##
  47. ## Jan  158
  48. ## Feb  168
  49. ## Mar  205
  50.  
  51. ## Institutional data ($)
  52. ## Ju     248.41k
  53. ##
  54. ## Jul    448.34k
  55. ## Aug    390.38k
  56. ## Sep    833.84k
  57. ##
  58. ## Oct    805.32k
  59. ## Nov    1.20M
  60. ## Dec    883.56k
  61. ##
  62. ## Jan    853.73k
  63. ## Feb
  64. ## Mar
  65.  
  66. inst <- c(248410, 448340, 390380, 833840, 805320, 1200000, 883560, 853730)
  67.  
  68. e <- data.frame(a,b)
  69. names(e) <- c("Week", "Scripts")
  70.  
  71. f <- data.frame(m,inst)
  72. names(f) <- c("Month", "Dollars")
  73.  
  74. t = length(a)-1
  75. cwgr = ( ((b[t]+b[t+1])/2) / b[1] )^(1/t)-1
  76.  
  77. t_m = length(m)-1
  78. cmgr_i = ( ((inst[t_m]+inst[t_m+1])/2) / inst[1] )^(1/t_m)-1
  79.  
  80. cqgr = (cwgr+1)^13 -1
  81. cqgr_i = (cmgr_i+1)^3 -1
  82.  
  83. q419 <- head(tail(b,-3),13)
  84. q120 <- head(tail(b,-16),13)
  85. q220 <- head(tail(b,-29),13)
  86.  
  87. message("Retail Scripts Q4/19: ",  sum(q419), "  Q1/20: ", sum(q120), "  Q2/20: ", sum(q220))
  88. message("Weekly Mean    Q4/19: ",  round(mean(q419),1), " Q1/20: ", round(mean(q120),1), " Q2/20: ", round(mean(q220),1))
  89. message("QoQ Weekly Mean Growth: Q4-Q1: ", round((((mean(q120)-mean(q419)))/mean(q419))*100, 1), "% Q1-Q2: ",
  90.                                            round((((mean(q220)-mean(q120)))/mean(q120))*100, 1), "%")
  91.  
  92. png("nuzyra_retail.png",width=480,height=480)
  93. 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')
  94. dev.off()
  95.  
  96. png("nuzyra_inst.png",width=480,height=480)
  97. 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