Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated example dataset: cohordata #115

Merged
merged 17 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Imports:
survival
Suggests:
knitr,
qtl,
rmarkdown,
spelling,
testthat (>= 3.0.0)
Expand Down
28 changes: 25 additions & 3 deletions R/cohortdata.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
#' Cohort data on vaccineff
#'
#' Data from
#' 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).
#'
#' @docType data
#'
#' @usage cohortdata
#'
#' @format An object of class \code{"cross"}; see \code{\link[qtl]{read.cross}}.
#'
#' @format ## `cohortdata`
#' \describe{
#' \item{id}{Anonymous ID of the individual}
#' \item{sex}{Sex F/M}
#' \item{age}{Age (50-100)}
#' \item{death_date}{Registered death by COVID-19}
#' \item{death_other_causes}{Registered death by other causes}
#' \item{vaccine_date_1}{Registered date of the first dose}
#' \item{vaccine_date_2}{Registered date of the second dose}
#' \item{vaccine_1}{Brand of the first dose}
#' \item{vaccine_2}{Brand of the second dose}
#' }
#' @keywords datasets
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/estimate_vaccineff.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#' vaccinated_status = "v",
#' unvaccinated_status = "u",
#' immunization_delay = 15,
#' end_cohort = as.Date("2044-12-31"),
#' end_cohort = as.Date("2021-12-31"),
#' match = TRUE,
#' exact = c("age", "sex"),
#' nearest = NULL
Expand Down
2 changes: 1 addition & 1 deletion R/make_vaccineff_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#' vaccinated_status = "v",
#' unvaccinated_status = "u",
#' immunization_delay = 15,
#' end_cohort = as.Date("2044-12-31"),
#' end_cohort = as.Date("2021-12-31"),
#' match = TRUE,
#' exact = c("age", "sex"),
#' nearest = NULL
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ vaccineff_data <- make_vaccineff_data(
vaccinated_status = "v",
unvaccinated_status = "u",
immunization_delay = 15,
end_cohort = as.Date("2044-12-31"),
end_cohort = as.Date("2021-12-31"),
match = TRUE,
exact = "sex",
nearest = c(age = 1)
Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ out the models.
data("cohortdata")
head(cohortdata, 5)
#> id sex age death_date death_other_causes vaccine_date_1 vaccine_date_2
#> 1 afade1b2 F 37 <NA> <NA> <NA> <NA>
#> 2 556c8c76 M 19 <NA> <NA> <NA> <NA>
#> 3 04edf85a M 50 <NA> <NA> <NA> <NA>
#> 4 7e51a18e F 8 <NA> <NA> <NA> <NA>
#> 5 c5a83f56 M 66 <NA> <NA> <NA> <NA>
#> 1 04edf85a M 50 <NA> <NA> <NA> <NA>
#> 2 c5a83f56 M 66 <NA> <NA> <NA> <NA>
#> 3 82991731 M 81 <NA> <NA> <NA> <NA>
#> 4 afbab268 M 74 <NA> <NA> 2021-03-30 2021-05-16
#> 5 3faf2474 M 54 <NA> <NA> 2021-06-01 2021-06-22
#> vaccine_1 vaccine_2
#> 1 <NA> <NA>
#> 2 <NA> <NA>
#> 3 <NA> <NA>
#> 4 <NA> <NA>
#> 5 <NA> <NA>
#> 4 BRAND2 BRAND2
#> 5 BRAND1 BRAND1
```

The function `make_vaccineff_data` allows defining different aspects of
Expand All @@ -84,7 +84,7 @@ vaccineff_data <- make_vaccineff_data(
vaccinated_status = "v",
unvaccinated_status = "u",
immunization_delay = 15,
end_cohort = as.Date("2044-12-31"),
end_cohort = as.Date("2021-12-31"),
match = TRUE,
exact = "sex",
nearest = c(age = 1)
Expand All @@ -97,12 +97,10 @@ ve <- estimate_vaccineff(vaccineff_data, at = 180)
summary(ve)
#> Vaccine Effectiveness at 180 days computed as VE = 1 - HR:
#> VE lower.95 upper.95
#> 0.8457 0.7429 0.9074
#> 0.7254 0.5437 0.8347
#>
#> Schoenfeld test for Proportional Hazards assumption:
#> p-value = 0.0046
#> Warning in print.summary_vaccineff(x):
#> p-value < 0.05. Please check loglog plot for Proportional Hazards assumption
#> p-value = 0.1507

# Generate loglog plot to check proportional hazards
plot(ve, type = "loglog")
Expand Down
Binary file modified data/cohortdata.RData
Binary file not shown.
54 changes: 21 additions & 33 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,68 +1,56 @@
Bermúdez
CMD
COVID
Codecov
Epidemiologic
Epiverse
Gómez
Individuals’
Halloran
IDRC
Javeriana
Kaplan
Longini
Mariscal
Millán
ORCID
PCV
PPV
Pavlich
Pontificia
SMD
Schoenfeld
Springer
Struchiner
TND
Torvaldsen
Universidad
Unvaccinated
VE
WIP
Zulma
anonymised
codecov
confounders
cumincidence
de
disaggregated
doi
eq
frac
funder
ggplot
gh
github
https
informit
inmunization
img
invokeRestart
io
lifecycle
md
muffleWarning
packagename
recomended
repo
rmarkdown
surv
svg
unadjusted
unvaccinated
vacc
www
yaml
Kaplan
ggplot2
ggplot
steelblue
darkred
coh
MatchIt
loglog
cumincidence
SMD
surv
Bermúdez
IDRC
Érika
funder
invokeRestart
muffleWarning
unadjusted
eq
img
rmarkdown
Halloran
Longini
Springer
Struchiner
Binary file removed inst/extdata/cohortdata.RData
Binary file not shown.
29 changes: 27 additions & 2 deletions man/cohortdata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/estimate_vaccineff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified man/figures/README-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion man/make_vaccineff_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions tests/testthat/_snaps/coh_immunization.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
Code
head(immunization_dose, 20)
Output
[1] NA NA NA NA
[5] NA "vaccine_date_2" NA NA
[9] "vaccine_date_2" "vaccine_date_2" NA "vaccine_date_2"
[13] NA NA NA NA
[17] NA "vaccine_date_2" "vaccine_date_2" "vaccine_date_2"
[1] NA NA NA "vaccine_date_2"
[5] "vaccine_date_2" "vaccine_date_2" NA "vaccine_date_2"
[9] NA NA NA "vaccine_date_2"
[13] "vaccine_date_2" "vaccine_date_2" "vaccine_date_2" "vaccine_date_2"
[17] "vaccine_date_2" "vaccine_date_2" "vaccine_date_2" "vaccine_date_2"

# `immunization_vaccine`: Basic expectations

Code
head(which_vaccine, 30)
Output
[1] NA NA NA NA NA "BRAND1" NA NA
[9] "BRAND1" "BRAND1" NA "BRAND2" NA NA NA NA
[17] NA "BRAND2" "BRAND1" "BRAND2" NA "BRAND1" NA NA
[25] NA NA "BRAND2" NA NA NA
[1] NA NA NA "BRAND2" "BRAND1" "BRAND2" NA "BRAND2"
[9] NA NA NA "BRAND1" "BRAND1" "BRAND2" "BRAND2" "BRAND2"
[17] "BRAND1" "BRAND1" "BRAND1" "BRAND1" "BRAND2" "BRAND2" NA NA
[25] "BRAND2" "BRAND1" "BRAND2" NA NA "BRAND2"

16 changes: 8 additions & 8 deletions tests/testthat/_snaps/coh_match.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
{
"type": "double",
"attributes": {},
"value": [30.18416801, 0.5088853, 0.4911147]
"value": [63.23626374, 0.52197802, 0.47802198]
},
{
"type": "double",
"attributes": {},
"value": [47.51706037, 0.54855643, 0.45144357]
"value": [63.66823899, 0.59748428, 0.40251572]
},
{
"type": "double",
"attributes": {},
"value": [0.87245622, 0.0795363, -0.0795363]
"value": [0.03984279, 0.15254353, -0.15254353]
}
]
}
Expand Down Expand Up @@ -85,17 +85,17 @@
{
"type": "double",
"attributes": {},
"value": [42.55192878, 0.54599407, 0.45400593]
"value": [63.2005571, 0.52089136, 0.47910864]
},
{
"type": "double",
"attributes": {},
"value": [44.90801187, 0.54599407, 0.45400593]
"value": [63.54038997, 0.52089136, 0.47910864]
},
{
"type": "double",
"attributes": {},
"value": [0.12717971, 0, 0]
"value": [0.03161695, 0, 0]
}
]
}
Expand Down Expand Up @@ -137,12 +137,12 @@
{
"type": "integer",
"attributes": {},
"value": [619, 337, 282]
"value": [364, 359, 5]
},
{
"type": "integer",
"attributes": {},
"value": [381, 337, 44]
"value": [636, 359, 277]
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/coh_match_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
summary
Output
u v
All 619 381
Matched 337 337
Unmatched 282 44
All 364 636
Matched 359 359
Unmatched 5 277

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/coh_time_to_event.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Code
head(exposition_time, 20)
Output
[1] 280 280 162 171 169 280 280 37 280 280 280 280 280 280 280 280 171 213 280
[20] 98
[1] 152 161 167 224 221 242 281 183 281 250 165 281 194 281 123 225 281 281 281
[20] 281

2 changes: 1 addition & 1 deletion tests/testthat/test-coh_eff_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ vaccineff_data <- make_vaccineff_data(
vaccinated_status = "v",
unvaccinated_status = "u",
immunization_delay = 15,
end_cohort = as.Date("2044-12-31"),
end_cohort = as.Date("2021-12-31"),
match = FALSE
)

Expand Down
Loading
Loading