CMA2: CMA2 and CMA4 constructors.

Description Usage Arguments Details Value See Also Examples

Description

Constructs a CMA (continuous multiple-interval measures of medication availability/gaps) type 2 or type 4 object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
CMA2(data = NULL, ID.colname = NA, event.date.colname = NA,
  event.duration.colname = NA, followup.window.start = 0,
  followup.window.start.unit = c("days", "weeks", "months", "years")[1],
  followup.window.duration = 365 * 2,
  followup.window.duration.unit = c("days", "weeks", "months",
  "years")[1], observation.window.start = 0,
  observation.window.start.unit = c("days", "weeks", "months",
  "years")[1], observation.window.duration = 365 * 2,
  observation.window.duration.unit = c("days", "weeks", "months",
  "years")[1], date.format = "%m/%d/%Y", summary = NA,
  event.interval.colname = "event.interval",
  gap.days.colname = "gap.days",
  force.NA.CMA.for.failed.patients = TRUE, parallel.backend = c("none",
  "multicore", "snow", "snow(SOCK)", "snow(MPI)", "snow(NWS)")[1],
  parallel.threads = "auto", suppress.warnings = FALSE,
  arguments.that.should.not.be.defined = c(carryover.within.obs.window =
  FALSE, carryover.into.obs.window = FALSE, carry.only.for.same.medication
  = FALSE, consider.dosage.change = FALSE), ...)

CMA4(data = NULL, ID.colname = NA, event.date.colname = NA,
  event.duration.colname = NA, followup.window.start = 0,
  followup.window.start.unit = c("days", "weeks", "months", "years")[1],
  followup.window.duration = 365 * 2,
  followup.window.duration.unit = c("days", "weeks", "months",
  "years")[1], observation.window.start = 0,
  observation.window.start.unit = c("days", "weeks", "months",
  "years")[1], observation.window.duration = 365 * 2,
  observation.window.duration.unit = c("days", "weeks", "months",
  "years")[1], date.format = "%m/%d/%Y", summary = NA,
  event.interval.colname = "event.interval",
  gap.days.colname = "gap.days",
  force.NA.CMA.for.failed.patients = TRUE, parallel.backend = c("none",
  "multicore", "snow", "snow(SOCK)", "snow(MPI)", "snow(NWS)")[1],
  parallel.threads = "auto", suppress.warnings = FALSE,
  arguments.that.should.not.be.defined = c(carryover.within.obs.window =
  FALSE, carryover.into.obs.window = FALSE, carry.only.for.same.medication
  = FALSE, consider.dosage.change = FALSE), ...)

Arguments

data

A data.frame containing the events used to compute the CMA. Must contain, at a minimum, the patient unique ID, the event date and duration, and might also contain the daily dosage and medication type (the actual column names are defined in the following four parameters).

ID.colname

A string, the name of the column in data containing the unique patient ID; must be present.

event.date.colname

A string, the name of the column in data containing the start date of the event (in the format given in the date.format parameter); must be present.

event.duration.colname

A string, the name of the column in data containing the event duration (in days); must be present.

followup.window.start

If a Date object, it represents the actual start date of the follow-up window; if a string it is the name of the column in data containing the start date of the follow-up window either as the numbers of followup.window.start.unit units after the first event (the column must be of type numeric) or as actual dates (in which case the column must be of type Date); if a number it is the number of time units defined in the followup.window.start.unit parameter after the begin of the participant's first event; or NA if not defined.

followup.window.start.unit

can be either "days", "weeks", "months" or "years", and represents the time units that followup.window.start refers to (when a number), or NA if not defined.

followup.window.duration

either a number representing the duration of the follow-up window in the time units given in followup.window.duration.unit, or a string giving the column containing these numbers. Should represent a period for which relevant medication events are recorded accurately (e.g. not extend after end of relevant treatment, loss-to-follow-up or change to a health care provider not covered by the database).

followup.window.duration.unit

can be either "days", "weeks", "months" or "years", and represents the time units that followup.window.duration refers to, or NA if not defined.

observation.window.start, observation.window.start.unit, observation.window.duration, observation.window.duration.unit

the definition of the observation window (see the follow-up window parameters above for details).

date.format

A string giving the format of the dates used in the data and the other parameters; see the format parameters of the as.Date function for details (NB, this concerns only the dates given as strings and not as Date objects).

summary

Metadata as a string, briefly describing this CMA.

event.interval.colname

A string, the name of a newly-created column storing the number of days between the start of the current event and the start of the next one; the default value "event.interval" should be changed only if there is a naming conflict with a pre-existing "event.interval" column in event.info.

gap.days.colname

A string, the name of a newly-created column storing the number of days when medication was not available (i.e., the "gap days"); the default value "gap.days" should be changed only if there is a naming conflict with a pre-existing "gap.days" column in event.info.

force.NA.CMA.for.failed.patients

Logical describing how the patients for which the CMA estimation fails are treated: if TRUE they are returned with an NA CMA estimate, while for FALSE they are omitted.

parallel.backend

Can be "none" (the default) for single-threaded execution, "multicore" (using mclapply in package parallel) for multicore processing (NB. not currently implemented on MS Windows and automatically falls back on "snow" on this platform), or "snow", "snow(SOCK)" (equivalent to "snow"), "snow(MPI)" or "snow(NWS)" specifying various types of SNOW clusters (can be on the local machine or more complex setups – please see the documentation of package snow for details; the last two require packages Rmpi and nws, respectively, not automatically installed with AdhereR).

parallel.threads

Can be "auto" (for parallel.backend == "multicore", defaults to the number of cores in the system as given by options("cores"), while for parallel.backend == "snow", defaults to 2), a strictly positive integer specifying the number of parallel threads, or a more complex specification of the SNOW cluster nodes for parallel.backend == "snow" (see the documentation of package snow for details).

suppress.warnings

Logical, if TRUE don't show any warnings.

arguments.that.should.not.be.defined

a list of argument names and pre-defined valuesfor which a warning should be thrown if passed to the function.

...

other possible parameters

Details

CMA2 considers the total number of days with medication supplied in all medication events in the observation window, including the last event. CMA4 is identical to CMA2 except that it is capped at 100%.

The formula is

(number of days supply including last event) / (first to last event)

Thus, the durations of all events are added up, possibly resulting in an CMA estimate (much) bigger than 1.0 (100%)

CMA2 and CMA1 differ in the inclusion or not of the last event.

Value

An S3 object of class CMA2 (derived from CMA0) with the following fields:

See Also

CMAs 1 to 8 are defined in:

Vollmer, W. M., Xu, M., Feldstein, A., Smith, D., Waterbury, A., & Rand, C. (2012). Comparison of pharmacy-based measures of medication adherence. BMC Health Services Research, 12, 155. http://doi.org/10.1186/1472-6963-12-155.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
cma2 <- CMA2(data=med.events,
             ID.colname="PATIENT_ID",
             event.date.colname="DATE",
             event.duration.colname="DURATION",
             followup.window.start=30,
             observation.window.start=30,
             observation.window.duration=365,
             date.format="%m/%d/%Y"
            );
cma4 <- CMA4(data=med.events,
             ID.colname="PATIENT_ID",
             event.date.colname="DATE",
             event.duration.colname="DURATION",
             followup.window.start=30,
             observation.window.start=30,
             observation.window.duration=365,
             date.format="%m/%d/%Y"
            );
## End(Not run)

AdhereR documentation built on May 2, 2019, 12:40 p.m.