| CMA2 {AdhereR} | R Documentation |
CMA2 and CMA4 constructors.
Description
Constructs a CMA (continuous multiple-interval measures of medication availability/gaps) type 2 or type 4 object.
Usage
CMA2(
data = NULL,
ID.colname = NA,
event.date.colname = NA,
event.duration.colname = NA,
medication.groups = NULL,
flatten.medication.groups = FALSE,
medication.groups.colname = ".MED_GROUP_ID",
followup.window.start = 0,
followup.window.start.unit = c("days", "weeks", "months", "years")[1],
followup.window.start.per.medication.group = FALSE,
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,
suppress.special.argument.checks = TRUE,
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,
medication.groups = NULL,
flatten.medication.groups = FALSE,
medication.groups.colname = ".MED_GROUP_ID",
followup.window.start = 0,
followup.window.start.unit = c("days", "weeks", "months", "years")[1],
followup.window.start.per.medication.group = FALSE,
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,
suppress.special.argument.checks = TRUE,
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 |
ID.colname |
A string, the name of the column in |
event.date.colname |
A string, the name of the column in
|
event.duration.colname |
A string, the name of the column in
|
medication.groups |
A vector of characters defining medication
groups or the name of a column in |
flatten.medication.groups |
Logical, if |
medication.groups.colname |
a string (defaults to ".MED_GROUP_ID")
giving the name of the column storing the group name when
|
followup.window.start |
If a |
followup.window.start.unit |
can be either "days",
"weeks", "months" or "years", and represents the time
units that |
followup.window.start.per.medication.group |
a logical: if there are
medication groups defined and this is |
followup.window.duration |
either a number representing the
duration of the follow-up window in the time units given in
|
followup.window.duration.unit |
can be either "days",
"weeks", "months" or "years", and represents the time
units that |
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
|
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 |
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 |
force.NA.CMA.for.failed.patients |
Logical describing how the
patients for which the CMA estimation fails are treated: if |
parallel.backend |
Can be "none" (the default) for single-threaded
execution, "multicore" (using |
parallel.threads |
Can be "auto" (for |
suppress.warnings |
Logical, if |
suppress.special.argument.checks |
Logical parameter for internal
use; if |
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:
-
dataThe actual event data, as given by thedataparameter. -
ID.colnamethe name of the column indatacontaining the unique patient ID, as given by theID.colnameparameter. -
event.date.colnamethe name of the column indatacontaining the start date of the event (in the format given in thedate.formatparameter), as given by theevent.date.colnameparameter. -
event.duration.colnamethe name of the column indatacontaining the event duration (in days), as given by theevent.duration.colnameparameter. -
event.daily.dose.colnamethe name of the column indatacontaining the prescribed daily dose, as given by theevent.daily.dose.colnameparameter. -
medication.class.colnamethe name of the column indatacontaining the classes/types/groups of medication, as given by themedication.class.colnameparameter. -
followup.window.startthe beginning of the follow-up window, as given by thefollowup.window.startparameter. -
followup.window.start.unitthe time unit of thefollowup.window.start, as given by thefollowup.window.start.unitparameter. -
followup.window.durationthe duration of the follow-up window, as given by thefollowup.window.durationparameter. -
followup.window.duration.unitthe time unit of thefollowup.window.duration, as given by thefollowup.window.duration.unitparameter. -
observation.window.startthe beginning of the observation window, as given by theobservation.window.startparameter. -
observation.window.start.unitthe time unit of theobservation.window.start, as given by theobservation.window.start.unitparameter. -
observation.window.durationthe duration of the observation window, as given by theobservation.window.durationparameter. -
observation.window.duration.unitthe time unit of theobservation.window.duration, as given by theobservation.window.duration.unitparameter. -
date.formatthe format of the dates, as given by thedate.formatparameter. -
summarythe metadata, as given by thesummaryparameter. -
event.infothedata.framecontaining the event info (irrelevant for most users; seecompute.event.int.gapsfor details). -
CMAthedata.framecontaining the actualCMAestimates for each participant (theID.colnamecolumn).
Please note that if medication.groups are defined, then the CMA
and event.info are named lists, each element containing the CMA and
event.info corresponding to a single medication group (the element's name).
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. doi: 10.1186/1472-6963-12-155.
Examples
## 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)