AdhereR icon indicating copy to clipboard operation
AdhereR copied to clipboard

>100% CMA_sliding_window

Open dffyfe opened this issue 4 years ago • 1 comments

Hi Dan,

I've been comparing CMA7 to Ambers manual Adherence work and it seems pretty much bang on (I think any differences can be put down to rounding or human error). One thing that would be good as an addition is the option to show >100% adherence on the sliding window with all the overuse going into the last window. i.e. in the example below show 100%, 100%, 100%, 364%. Obviously if it was 1 window we'd want to show overuse in that.

GT100 <- tribble(
  ~PATIENT_ID,	~DATE,	~PERDAY,	~CATEGORY,	~DURATION,
  1,	"2020-06-01",	2,	"medA",	40,
  1,	"2020-06-29",	2,	"medA",	40,
  1,	"2020-07-27",	2,	"medA",	40,
  1,	"2020-08-24",	2,	"medA",	40,
  1,	"2020-09-21",	2,	"medA",	40,
  1,	"2020-10-19",	2,	"medA",	40,
  1,	"2020-11-16",	2,	"medA",	40,
  1,	"2020-12-14",	2,	"medA",	40,
  1,	"2021-01-11",	2,	"medA",	40,
  1,	"2021-02-08",	2,	"medA",	40,
  1,	"2021-03-08",	2,	"medA",	40,
  1,	"2021-04-05",	2,	"medA",	40,
  1,	"2021-05-03",	2,	"medA",	40,
  1,	"2021-05-31",	2,	"medA",	40,
  1,	"2021-06-28",	2,	"medA",	40,
  1,	"2021-07-26",	2,	"medA",	40,
  1,	"2021-08-23",	2,	"medA",	40,
  1,	"2021-09-20",	2,	"medA",	40,
  1,	"2021-10-18",	2,	"medA",	40,
  1,	"2021-11-15",	2,	"medA",	40,
  1,	"2021-12-13",	2,	"medA",	40
)

GT100$DATE <- as.Date(GT100$DATE)

cma7 <- CMA_sliding_window(CMA.to.apply = "CMA7",
                           data=GT100,
                           ID.colname = "PATIENT_ID",
                           event.date.colname = "DATE",
                           event.duration.colname = "DURATION",
                           medication.class.colname = "CATEGORY",
                           carry.only.for.same.medication = FALSE,
                           followup.window.start = as.Date("2020-06-01"),
                           followup.window.start.unit = "days",
                           followup.window.duration = 600,
                           followup.window.duration.unit = "days",
                           observation.window.start = as.Date("2021-01-01"), 
                           observation.window.start.unit = "days",
                           observation.window.duration = 365,
                           observation.window.duration.unit = "days",
                           sliding.window.start = 0,
                           sliding.window.start.unit = "days",
                           sliding.window.duration = 91,
                           sliding.window.duration.unit = "days",
                           #sliding.window.step.duration = 91,
                           #sliding.window.step.unit = "days",
                           sliding.window.no.steps = 4,
                           date.format = "%Y-%m-%d")

plot(cma7, show.period = "dates", 
     period.in.days = 28,
     show.legend = FALSE,
     ylab = c(withCMA = "Section - Drug Name"),
     cex.axis = 1,
     title = "CHIno",
     CMA.cex = 0.8,
     plot.CMA = T,
     plot.CMA.as.histogram = F,
     CMA.plot.ratio = 0.000000000000000000000001,
     min.plot.size.in.characters.horiz=0,
     min.plot.size.in.characters.vert=0)

Best,

David

dffyfe avatar Jan 28 '21 17:01 dffyfe

Actually seems to be a more general question about a new (?) CMA that can allow (controlled) overuse...

ddediu avatar May 25 '22 14:05 ddediu