Package 'vaccineff'

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

Help Index


Cohort data on vaccineff

Description

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).

Usage

cohortdata

Format

cohortdata

id

Anonymous ID of the individual

sex

Sex F/M

age

Age (50-100)

death_date

Registered death by COVID-19

death_other_causes

Registered death by other causes

vaccine_date_1

Registered date of the first dose

vaccine_date_2

Registered date of the second dose

vaccine_1

Brand of the first dose

vaccine_2

Brand of the second dose

Examples

cohortdata

Estimate Vaccine Effectiveness (VE)

Description

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.

Usage

estimate_vaccineff(vaccineff_data, at)

Arguments

vaccineff_data

Object of the class vaccineff_data with vaccineff data.

at

Number of days at which VE is estimated from the beginning of the follow-up period.

Value

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

Examples

# 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)

Construct age-group variable from age column

Description

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.

Usage

get_age_group(data_set, col_age, max_val, min_val = 0, step)

Arguments

data_set

data.frame with at least a column containing the age information

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

Value

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⁠.

Examples

# 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)

Construct vaccineff_data Object

Description

This function constructs an S3 object of the class vaccineff_data that contains all the relevant information for the study. to estimate the effectiveness.

Usage

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
)

Arguments

data_set

data.frame with cohort information.

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 vacc_date_col.

vaccinated_status

Status assigned to the vaccinated population. Default is v.

unvaccinated_status

Status assigned to the unvaccinated population. Default is u.

immunization_delay

Characteristic time in days before the patient is considered immune. Default is 0.

end_cohort

End date of the study.

match

TRUE: cohort matching is performed. Default is FALSE

exact

Name(s) of column(s) for exact matching. Default is NULL.

nearest

Named vector with name(s) of column(s) for nearest matching and caliper(s) for each variable (e.g., nearest = c("characteristic1" = n1, "characteristic2" = n2), where n1 and n2 are the calipers). Default is NULL.

take_first

FALSE: takes the latest vaccine date. TRUE: takes the earliest vaccine date.

t0_follow_up

Column with the initial dates of the follow-up period. This column is only used if match = FALSE. If not provided, the follow-up period starts at start_cohort. Default is NULL.

Value

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.

Examples

# 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)

Function for Extracting Vaccine Effectiveness Plot

Description

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).

Usage

## S3 method for class 'vaccineff'
plot(
  x,
  type = c("loglog", "surv"),
  cumulative = FALSE,
  percentage = FALSE,
  ...
)

Arguments

x

Object of class vaccineff.

type

Type of plot. Options are loglog and surv.

cumulative

If TRUE, the survival curve is shown as cumulative incidence.

percentage

If TRUE, results are shown on a percentage scale.

...

Additional arguments passed to other functions.

Value

Plot extracted from vaccineff.


Function for Extracting Vaccineff Data Plot

Description

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.

Usage

## S3 method for class 'vaccineff_data'
plot(x, date_interval = NULL, cumulative = FALSE, ...)

Arguments

x

Object of class vaccineff_data.

date_interval

If NULL, the function calculates the coverage interval

cumulative

If TRUE, returns the cumulative number of doses over the time window.

...

Additional arguments passed to other functions.

Value

Plot extracted from vaccineff.


Print summary of VE Results

Description

Print summary of vaccineff object.

Usage

## S3 method for class 'summary_vaccineff'
print(x, ...)

Arguments

x

Object of the class summary.vaccineff.

...

Additional arguments passed to other functions.

Value

None


Print Summary of Vaccineff Data

Description

Summarizes the results of make_vaccineff_data.

Usage

## S3 method for class 'summary_vaccineff_data'
print(x, ...)

Arguments

x

Object of the class summary.vaccineff_data.

...

Additional arguments passed to other functions.

Value

None


Summarize VE Results

Description

Summarizes the results of vaccineff.

Usage

## S3 method for class 'vaccineff'
summary(object, ...)

Arguments

object

Object of the class vaccineff.

...

Additional arguments passed to other functions.

Value

Summary of the results from estimate_vaccineff.


Summarize Vaccineff Data

Description

Summarizes the results of make_vaccineff_data.

Usage

## S3 method for class 'vaccineff_data'
summary(object, warnings_log = FALSE, ...)

Arguments

object

Object of the class vaccineff_data.

warnings_log

If TRUE, prints the warnings log.

...

Additional arguments passed to other functions.

Value

Summary of the results from vaccineff data