CMA0 {AdhereR}R Documentation

CMA0 constructor.

Description

Constructs a basic CMA (continuous multiple-interval measures of medication availability/gaps) object.

Usage

CMA0(
  data = NULL,
  ID.colname = NA,
  event.date.colname = NA,
  event.duration.colname = NA,
  event.daily.dose.colname = NA,
  medication.class.colname = NA,
  medication.groups = NULL,
  flatten.medication.groups = FALSE,
  medication.groups.colname = ".MED_GROUP_ID",
  carryover.within.obs.window = NA,
  carryover.into.obs.window = NA,
  carry.only.for.same.medication = NA,
  consider.dosage.change = NA,
  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 = "Base CMA object",
  suppress.warnings = FALSE,
  suppress.special.argument.checks = FALSE,
  arguments.that.should.not.be.defined = NULL,
  ...
)

Arguments

data

A data.frame containing the medication events (prescribing or dispensing) 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, or NA if not defined.

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), or NA if not defined.

event.duration.colname

A string, the name of the column in data containing the event duration (in days), or NA if not defined.

event.daily.dose.colname

A string, the name of the column in data containing the prescribed daily dose, or NA if not defined.

medication.class.colname

A string, the name of the column in data containing the classes/types/groups of medication, or NA if not defined.

medication.groups

A vector of characters defining medication groups or the name of a column in data that defines such groups. The names of the vector are the medication group unique names, while the content defines them as logical expressions. While the names can be any string of characters except "}", it is recommended to stick to the rules for defining vector names in R. For example, c("A"="CATEGORY == 'medA'", "AA"="{A} & PERDAY < 4" defines two medication groups: A which selects all events of type "medA", and B which selects all events already defined by "A" but with a daily dose lower than 4. If NULL, no medication groups are defined. If medication groups are defined, there is one CMA estimate for each group; moreover, there is a special group __ALL_OTHERS__ automatically defined containing all observations not covered by any of the explicitly defined groups.

flatten.medication.groups

Logical, if FALSE (the default) then the CMA and event.info components of the object are lists with one medication group per element; otherwise, they are data.frames with an extra column containing the medication group (its name is given by medication.groups.colname).

medication.groups.colname

a string (defaults to ".MED_GROUP_ID") giving the name of the column storing the group name when flatten.medication.groups is TRUE.

carryover.within.obs.window

Logical, if TRUE consider the carry-over within the observation window, or NA if not defined.

carryover.into.obs.window

Logical, if TRUE consider the carry-over from before the starting date of the observation window, or NA if not defined.

carry.only.for.same.medication

Logical, if TRUE the carry-over applies only across medications of the same type, or NA if not defined.

consider.dosage.change

Logical, if TRUE the carry-over is adjusted to reflect changes in dosage, or NA if not defined.

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 or a string that conforms to the format specified in date.format); 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.start.per.medication.group

a logical: if there are medication groups defined and this is TRUE, then the first event considered for the follow-up window start is relative to each medication group separately, otherwise (the default) it is relative to the patient.

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.

suppress.warnings

Logical, if TRUE don't show any warnings.

suppress.special.argument.checks

Logical parameter for internal use; if FALSE (default) check if the important columns in the data have some of the reserved names, if TRUE this check is not performed.

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

In most cases this should not be done directly by the user, but it is used internally by the other CMAs.

Value

An S3 object of class CMA0 with the following fields:

Examples

cma0 <- CMA0(data=med.events,
             ID.colname="PATIENT_ID",
             event.date.colname="DATE",
             event.duration.colname="DURATION",
             event.daily.dose.colname="PERDAY",
             medication.class.colname="CATEGORY",
             followup.window.start=0,
             followup.window.start.unit="days",
             followup.window.duration=2*365,
             followup.window.duration.unit="days",
             observation.window.start=30,
             observation.window.start.unit="days",
             observation.window.duration=365,
             observation.window.duration.unit="days",
             date.format="%m/%d/%Y",
             summary="Base CMA");

[Package AdhereR version 0.8.1 Index]