plotTimeToEvent( cohortMethodData, population = NULL, outcomeId, firstExposureOnly = FALSE, restrictToCommonPeriod = FALSE, washoutPeriod = 0, removeDuplicateSubjects = FALSE, minDaysAtRisk = 1, riskWindowStart = 0, addExposureDaysToStart = NULL, startAnchor = "cohort start", riskWindowEnd = 0, addExposureDaysToEnd = NULL, endAnchor = "cohort end", censorAtNewRiskWindow = FALSE, periodLength = 7, numberOfPeriods = 52, showFittedLines = TRUE, targetLabel = "Target", comparatorLabel = "Comparator", title = NULL, fileName = NULL )
An object of type
If specified, this population will be used as the starting
point instead of the cohorts in the
The ID of the outcome. If not specified, no outcome-specific transformations will be performed.
Should only the first exposure per subject be included? Note
that this is typically done in the
Restrict the analysis to the period when both exposures are observed?
The mininum required continuous observation time prior to index date for a person to be included in the cohort.
Remove subjects that are in both the target and comparator cohort? See details for allowed values.
The minimum required number of days at risk.
The start of the risk window (in days) relative to the
DEPRECATED: Add the length of exposure the start of the risk window?
The anchor point for the start of the risk window. Can be "cohort start" or "cohort end".
The end of the risk window (in days) relative to the
DEPRECATED: Add the length of exposure the risk window?
The anchor point for the end of the risk window. Can be "cohort start" or "cohort end".
If a subject is in multiple cohorts, should time-at-risk be censored when the new time-at-risk starts to prevent overlap?
The length in days of each period shown in the plot.
Number of periods to show in the plot. The periods are equaly divided before and after the index date.
Fit lines to the proportions and show them in the plot?
A label to us for the target cohort.
A label to us for the comparator cohort.
Optional: the main title for the plot.
Name of the file where the plot should be saved, for example
'plot.png'. See the function
A ggplot object. Use the
ggsave function to save to file in a different
Creates a plot showing the number of events over time in the target and comparator cohorts, both before and after
index date. The plot also distinguishes between events inside and outside the time-at-risk period. This requires
the user to (re)specify the time-at-risk using the same arguments as the
Note that it is not possible to specify that people with the outcome prior should be removed, since the plot will
show these prior events.