compute.treatment.episodes | R Documentation |
For a given event (prescribing or dispensing) database, compute the treatment episodes for each patient in various scenarious.
compute.treatment.episodes( data, ID.colname = NA, event.date.colname = NA, event.duration.colname = NA, event.daily.dose.colname = NA, medication.class.colname = NA, carryover.within.obs.window = TRUE, carry.only.for.same.medication = TRUE, consider.dosage.change = TRUE, medication.change.means.new.treatment.episode = TRUE, dosage.change.means.new.treatment.episode = FALSE, maximum.permissible.gap = 90, maximum.permissible.gap.unit = c("days", "weeks", "months", "years", "percent")[1], maximum.permissible.gap.append.to.episode = FALSE, 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], event.interval.colname = "event.interval", gap.days.colname = "gap.days", return.mapping.events.episodes = FALSE, date.format = "%m/%d/%Y", parallel.backend = c("none", "multicore", "snow", "snow(SOCK)", "snow(MPI)", "snow(NWS)")[1], parallel.threads = "auto", suppress.warnings = FALSE, suppress.special.argument.checks = FALSE, return.data.table = FALSE, ... )
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
|
event.daily.dose.colname |
A string, the name of the column in
|
medication.class.colname |
A string, the name of the column in
|
carryover.within.obs.window |
Logical, if |
carry.only.for.same.medication |
Logical, if |
consider.dosage.change |
Logical, if |
medication.change.means.new.treatment.episode |
Logical, should a change in medication automatically start a new treatment episode? |
dosage.change.means.new.treatment.episode |
Logical, should a change in dosage automatically start a new treatment episode? |
maximum.permissible.gap |
The number of units given by
|
maximum.permissible.gap.unit |
can be either "days",
"weeks", "months", "years" or "percent", and
represents the time units that |
maximum.permissible.gap.append.to.episode |
a logical value
specifying of the |
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.duration |
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 |
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 |
return.mapping.events.episodes |
A Logical, if |
date.format |
A string giving the format of the dates used in the
|
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 |
return.data.table |
Logical, if |
... |
extra arguments. |
This should in general not be called directly by the user, but is provided as a basis for the extension to new CMAs.
For the last treatment episode, the gap is considered only when longer than the maximum permissible gap. Please note the following:
episode starts at first medication event for a particular medication,
episode ends on the day when the last supply of that medication finished or if a period longer than the permissible gap preceded the next medication event, or at the end of the FUW,
end episode gap days represents either the number of days after the end of the treatment episode (if medication changed, or if a period longer than the permissible gap preceded the next medication event) or at the end of (and within) the episode, i.e. the number of days after the last supply finished (if no other medication event followed until the end of the FUW),
the duration of the episode is the interval between the episode start and episode end (and may include the gap days at the end, in the latter condition described above),
the number of gap days after the end of the episode can be computed as all values larger than the permissible gap and 0 otherwise,
if medication change starts new episode, then previous episode ends when the last supply is finished (irrespective of the length of gap compared to a maximum permissible gap); any days before the date of the new medication supply are considered a gap; this maintains consistency with gaps between episodes (whether they are constructed based on the maximum permissible gap rule or the medication change rule).
A data.frame
or data.table
with the following columns
(or NULL
if no
treatment episodes could be computed):
patid
the patient ID.
episode.ID
the episode unique ID (increasing sequentially).
episode.start
the episode start date.
end.episode.gap.days
the corresponding gap days of the last event in this episode.
episode.duration
the episode duration in days.
episode.end
the episode end date.
If mapping.episodes.to.events
is TRUE
, then this also has an
attribute mapping.episodes.to.events
that gives the mapping between
episodes and events as a data.table
with the following columns:
patid
the patient ID.
episode.ID
the episode unique ID (increasing sequentially).
event.index.in.data
the event given by its row number in the data
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.