Title: | Estimate Vaccine Effectiveness Based on Different Study Designs |
---|---|
Description: | Provides tools for estimating vaccine effectiveness and related metrics. The 'vaccineff_data' class manages key features for preparing, visualizing, and organizing cohort data, as well as estimating vaccine effectiveness. The results and model performance are assessed using the 'vaccineff' class. |
Authors: | David Santiago Quevedo [aut] , Zulma M. Cucunubá [aut, cre] , International Development Research Center (IDRC) [fnd], Geraldine Gómez Millán [ctb] , Pratik Gupte [ctb] , Érika J Cantor [ctb] , Santiago Loaiza [ctb] , Jaime Pavlich-Mariscal [ctb] , Hugo Gruson [ctb] , Chris Hartgerink [ctb] , Felipe Segundo Abril [ctb] , Joshua W. Lambert [ctb] , Julian Otero [ctb] , Pontificia Universidad Javeriana [cph] |
Maintainer: | Zulma M. Cucunubá <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-11-29 13:57:15 UTC |
Source: | CRAN |
Subset of data from an anonymised, real-world dataset produced as part of the early stage of the immunization program against COVID-19 in Bogota, Colombia between February 2021 and December 2021. Cohort dataset contains registers of homologous schemes for two different brands for adults aged 50 years or older. This cohort received two doses of a vaccine aimed at reducing the risk of death. All the registers were anonymised and de-identified to preserve the privacy of data. The dataset includes disaggregated information on the first and second vaccine doses (vaccine_date1, vaccine_date2, vaccine1, and vaccine2) for each participant and relevant demographic details (sex and age). Additionally, the dataset includes the dates of two outcomes: death associated with COVID-19 (death_date) and death from other causes (death_other_causes).
cohortdata
cohortdata
cohortdata
Anonymous ID of the individual
Sex F/M
Age (50-100)
Registered death by COVID-19
Registered death by other causes
Registered date of the first dose
Registered date of the second dose
Brand of the first dose
Brand of the second dose
cohortdata
cohortdata
This function provides methods for estimating VE. It relies on
the Kaplan-Meier estimator and the Cox model for proportional hazards
from the {survival}
package. Currently, the default method is VE = 1 - HR,
where HR is the Hazard Ratio calculated using the Cox model. The
proportional hazards assumption is tested using the Schoenfeld test,
with the p-value provided in the results. Log-log plots are also generated
using the Kaplan-Meier estimator for a visual test of the proportional
hazards hypothesis. The function uses column names provided in the tags
outcome_status_col
, time_to_event_col
, and vaccine_status_col
of the
linelist
object and status names from make_vaccineff_data
.
The return is an S3 class
object with the VE (CI95%), results from the Cox
model, and the Kaplan-Meier estimator. This object is compatible with
summary
and plot
methods.
estimate_vaccineff(vaccineff_data, at)
estimate_vaccineff(vaccineff_data, at)
vaccineff_data |
Object of the class |
at |
Number of days at which VE is estimated from the beginning of the follow-up period. |
Object of the class vaccineff
: a list with results from the
estimation of VE.
ve
: data.frame
with VE(CI95%)
cox_model
: survival
object with Cox model results
kaplan_meier
: survival
object with Kaplan-Meier estimator
# Load example data data("cohortdata") # Create `vaccineff_data` vaccineff_data <- make_vaccineff_data(data_set = cohortdata, outcome_date_col = "death_date", censoring_date_col = "death_other_causes", vacc_date_col = "vaccine_date_2", vaccinated_status = "v", unvaccinated_status = "u", immunization_delay = 15, end_cohort = as.Date("2021-12-31"), match = TRUE, exact = c("age", "sex"), nearest = NULL ) # Estimate the Vaccine Effectiveness (VE) ve <- estimate_vaccineff(vaccineff_data, 90) # Print summary of VE summary(ve) # Generate loglog plot to check proportional hazards plot(ve, type = "loglog") # Generate Survival plot plot(ve, type = "surv", percentage = FALSE, cumulative = FALSE)
# Load example data data("cohortdata") # Create `vaccineff_data` vaccineff_data <- make_vaccineff_data(data_set = cohortdata, outcome_date_col = "death_date", censoring_date_col = "death_other_causes", vacc_date_col = "vaccine_date_2", vaccinated_status = "v", unvaccinated_status = "u", immunization_delay = 15, end_cohort = as.Date("2021-12-31"), match = TRUE, exact = c("age", "sex"), nearest = NULL ) # Estimate the Vaccine Effectiveness (VE) ve <- estimate_vaccineff(vaccineff_data, 90) # Print summary of VE summary(ve) # Generate loglog plot to check proportional hazards plot(ve, type = "loglog") # Generate Survival plot plot(ve, type = "surv", percentage = FALSE, cumulative = FALSE)
This method splits an age interval from min_val
to max_val
into intervals of size step
.
If the method finds ages greater or equal than max_val
it assigns the string ">max_val"
.
By default min_val
is set to 0, however it can be assigned by
convenience. If the method finds ages lower or equal
than min_val
it assigns the string "<min_val-1"
.
The function warns when (max_val - min_val) is not an integer multiple of
step. In that case the last interval is truncated to the upper value
closest to max_val for which (closest_upper - min_val) is multiple of step.
get_age_group(data_set, col_age, max_val, min_val = 0, step)
get_age_group(data_set, col_age, max_val, min_val = 0, step)
data_set |
|
col_age |
Name of the column containing the age information |
max_val |
Maximum value of age interval to split |
min_val |
Minimum value of age interval to split |
step |
Step used to split the age interval |
Column of type factor
with the same length as the number of rows
in data_set
, with levels corresponding to age bins between min_val
and
max_val
. Ages above max_val
are represented as >max_val
.
# load data provided with the package data(cohortdata) # assign age groups as a column of the `data.frame` cohortdata$age_group <- get_age_group( data_set = cohortdata, col_age = "age", max_val = 80, step = 10 ) # view the `data.frame` with new column head(cohortdata)
# load data provided with the package data(cohortdata) # assign age groups as a column of the `data.frame` cohortdata$age_group <- get_age_group( data_set = cohortdata, col_age = "age", max_val = 80, step = 10 ) # view the `data.frame` with new column head(cohortdata)
vaccineff_data
ObjectThis function constructs an S3 object of the class
vaccineff_data
that contains all the relevant information for the study.
to estimate the effectiveness.
make_vaccineff_data( data_set, outcome_date_col, censoring_date_col = NULL, vacc_date_col, vacc_name_col = NULL, vaccinated_status = "v", unvaccinated_status = "u", immunization_delay = 0, end_cohort, match = FALSE, exact = NULL, nearest = NULL, take_first = FALSE, t0_follow_up = NULL )
make_vaccineff_data( data_set, outcome_date_col, censoring_date_col = NULL, vacc_date_col, vacc_name_col = NULL, vaccinated_status = "v", unvaccinated_status = "u", immunization_delay = 0, end_cohort, match = FALSE, exact = NULL, nearest = NULL, take_first = FALSE, t0_follow_up = NULL )
data_set |
|
outcome_date_col |
Name of the column that contains the outcome dates. |
censoring_date_col |
Name of the column that contains the censoring date. NULL by default. |
vacc_date_col |
Name of the column(s) that contain the vaccine dates. |
vacc_name_col |
Name of the column(s) that contain custom vaccine
names for the vaccines (e.g. brand name, type of vaccine). If provided,
must be of the same length as |
vaccinated_status |
Status assigned to the vaccinated population.
Default is |
unvaccinated_status |
Status assigned to the unvaccinated population.
Default is |
immunization_delay |
Characteristic time in days before the patient is considered immune. Default is 0. |
end_cohort |
End date of the study. |
match |
|
exact |
Name(s) of column(s) for |
nearest |
Named vector with name(s) of column(s) for |
take_first |
|
t0_follow_up |
Column with the initial dates of the follow-up period.
This column is only used if |
An S3 object of class vaccineff_data
with all the information and
characteristics of the study. data.frames
are converted into an object of
class linelist
to easily handle with the data.
# Load example data data("cohortdata") # Create `vaccineff_data` vaccineff_data <- make_vaccineff_data(data_set = cohortdata, outcome_date_col = "death_date", censoring_date_col = "death_other_causes", vacc_date_col = "vaccine_date_2", vaccinated_status = "v", unvaccinated_status = "u", immunization_delay = 15, end_cohort = as.Date("2021-12-31"), match = TRUE, exact = c("age", "sex"), nearest = NULL ) # Print summary of data summary(vaccineff_data) # Plot vaccine coverage plot(vaccineff_data)
# Load example data data("cohortdata") # Create `vaccineff_data` vaccineff_data <- make_vaccineff_data(data_set = cohortdata, outcome_date_col = "death_date", censoring_date_col = "death_other_causes", vacc_date_col = "vaccine_date_2", vaccinated_status = "v", unvaccinated_status = "u", immunization_delay = 15, end_cohort = as.Date("2021-12-31"), match = TRUE, exact = c("age", "sex"), nearest = NULL ) # Print summary of data summary(vaccineff_data) # Plot vaccine coverage plot(vaccineff_data)
This function creates plots from an object of class
vaccineff
. It returns a Log-Log plot when type = "loglog"
,
or a Survival curve when type = "surv"
. Survival plots can be
shown as cumulative incidence (cumulative = TRUE
), and using
percentages (percentage = TRUE
).
## S3 method for class 'vaccineff' plot( x, type = c("loglog", "surv"), cumulative = FALSE, percentage = FALSE, ... )
## S3 method for class 'vaccineff' plot( x, type = c("loglog", "surv"), cumulative = FALSE, percentage = FALSE, ... )
x |
Object of class |
type |
Type of plot. Options are |
cumulative |
If |
percentage |
If |
... |
Additional arguments passed to other functions. |
Plot extracted from vaccineff
.
This function returns a plot of the vaccine coverage or the
cumulative coverage (if cumulative = TRUE). The return is a 2-axis ggplot2
element with the number of vaccines per date on the left axis and the
coverage per date on the right axis. When a matching routine is performed,
the left axis also accounts for the doses of the matched cohort.
## S3 method for class 'vaccineff_data' plot(x, date_interval = NULL, cumulative = FALSE, ...)
## S3 method for class 'vaccineff_data' plot(x, date_interval = NULL, cumulative = FALSE, ...)
x |
Object of class |
date_interval |
If NULL, the function calculates the coverage interval |
cumulative |
If |
... |
Additional arguments passed to other functions. |
Plot extracted from vaccineff
.
Print summary of vaccineff
object.
## S3 method for class 'summary_vaccineff' print(x, ...)
## S3 method for class 'summary_vaccineff' print(x, ...)
x |
Object of the class |
... |
Additional arguments passed to other functions. |
None
Summarizes the results of make_vaccineff_data
.
## S3 method for class 'summary_vaccineff_data' print(x, ...)
## S3 method for class 'summary_vaccineff_data' print(x, ...)
x |
Object of the class |
... |
Additional arguments passed to other functions. |
None
Summarizes the results of vaccineff
.
## S3 method for class 'vaccineff' summary(object, ...)
## S3 method for class 'vaccineff' summary(object, ...)
object |
Object of the class |
... |
Additional arguments passed to other functions. |
Summary of the results from estimate_vaccineff
.
Summarizes the results of make_vaccineff_data
.
## S3 method for class 'vaccineff_data' summary(object, warnings_log = FALSE, ...)
## S3 method for class 'vaccineff_data' summary(object, warnings_log = FALSE, ...)
object |
Object of the class |
warnings_log |
If |
... |
Additional arguments passed to other functions. |
Summary of the results from vaccineff data