Gettign Started with the 'recent' Package
introduction.Rmd
Introduction
This package implements the methods of Fellows et. al. 2022 for the calculation of incidence using recency assays such as LAg-Avidity. Because treated individuals and elite controllers are known to ave high false positivity rates on recency assays, individuals with low viral load or a previous HIV+ diagnosis are screened out. A previous diagnosis can be indicated by either a self-reported previous positive test or through the detection of ARV antibodies.
Data
The package includes example data, which we will be using in this vignette.
library(recent)
data("assay_data")
head(assay_data[1:7])
#> recent hiv undiagnosed elite_cntr tslt ever_hiv_test weights
#> 2139 FALSE TRUE FALSE TRUE 1232.54154 TRUE 72.32627
#> 6918 NA FALSE FALSE FALSE NA FALSE 195.87990
#> 5448 NA FALSE FALSE FALSE 73.66674 TRUE 87.99275
#> 3277 NA FALSE FALSE FALSE 54.07090 TRUE 77.74728
#> 3179 NA FALSE FALSE FALSE 25.08993 TRUE 117.30507
#> 3983 NA FALSE FALSE FALSE NA FALSE 137.49198
-
recent
: Logical. Did the subject test recent on the assay. -
hiv
: Logical. Is the subject HIV+. -
undiagnosed
: Logical. Has the subject never received a positive HIV test. -
elite_cntr
: Logical. Viral load test <1,000. -
tslt
: Numeric. Time since last HIV test in months. -
ever_hiv_test
: Logical. Has the subject never been tested for HIV. -
weights
: Numeric. Survey Weights. -
btwt001-btwt206
: Numeric. Jackknife replicate weights.
Incidence Estimation
Incidence is calculated using the rita_incidence
function. The frr
and assay_surv
are the reference FRR and reference probability of testing recent by day since seroconversion. Here we use values calculated for the LAg-Avidity assay. The default recency period (tau) is 2 years.
inc <- rita_incidence(
recent=assay_data$recent,
undiagnosed=assay_data$undiagnosed,
low_viral=assay_data$elite_cntr,
hiv=assay_data$hiv,
weights=assay_data$weights,
tslt=assay_data$tslt,
ever_hiv_test=assay_data$ever_hiv_test,
frr = lag_avidity_frr()[1],
assay_surv = lag_avidity_survival(2 * 365)
)
knitr::kable(inc)
incidence | residual_frr | omega_rs | omega_s | P(R|S) | P(S|H) | P(H) |
---|---|---|---|---|---|---|
0.0151573 | 0.0008827 | 0.2921342 | 1.093136 | 0.072833 | 0.195313 | 0.2480427 |
The function outputs the following values:
-
incidence
: The incidence. -
residual_frr
: The false recency rate accounting for the screening process. -
omega_rs
: The mean duration of recency up to tau accounting for the screening process. -
P(R|S)
: The proportion of screened in individual who test recent. -
P(S|H)
: The proportion of HIV+ individuals that are screened in. -
P(H)
: HIV prevalence.
By default the function estimates the time to diagnosis distribution using testing history information among undiagnosed HIV+ cases. If there are few of these, or their reliability is questionable, the HIV- population can be used instead by specifying ``.
inc <- rita_incidence(
recent=assay_data$recent,
undiagnosed=assay_data$undiagnosed,
low_viral=assay_data$elite_cntr,
hiv=assay_data$hiv,
weights=assay_data$weights,
tslt=assay_data$tslt,
ever_hiv_test=assay_data$ever_hiv_test,
frr = lag_avidity_frr()[1],
assay_surv = lag_avidity_survival(2 * 365),
test_history_population = "negative"
)
knitr::kable(inc)
incidence | residual_frr | omega_rs | omega_s | P(R|S) | P(S|H) | P(H) |
---|---|---|---|---|---|---|
0.0171628 | 0.0009378 | 0.2572542 | 0.8308294 | 0.072833 | 0.195313 | 0.2480427 |
Bootstrap Confidence Intervals
Calculation of confidence intervals using survey replicate weights is supported.
rep_weights <- dplyr::select(assay_data, dplyr::contains("btwt"))
ri <- rita_bootstrap(
recent=assay_data$recent,
undiagnosed=assay_data$undiagnosed,
low_viral=assay_data$elite_cntr,
hiv=assay_data$hiv,
weights=assay_data$weights,
tslt=assay_data$tslt,
ever_hiv_test=assay_data$ever_hiv_test,
rep_weights = rep_weights,
rep_weight_type = "JK1"
)
#> Warning in svrepdesign.default(repweights = rep_weights, weights = weights, :
#> scale (n-1)/n not provided: guessing n=number of replicates
knitr::kable(ri)
estimate | std_error | lower_bound | upper_bound | |
---|---|---|---|---|
incidence | 0.0151573 | 0.0110182 | -0.0064379 | 0.0367525 |
residual_frr | 0.0008827 | 0.0001937 | 0.0005030 | 0.0012623 |
omega_rs | 0.2921342 | 0.0193668 | 0.2541759 | 0.3300925 |
omega_s | 1.0931364 | 0.1296151 | 0.8390954 | 1.3471774 |
P(R|S) | 0.0728330 | 0.0471441 | -0.0195676 | 0.1652337 |
P(S|H) | 0.1953130 | 0.0255741 | 0.1451886 | 0.2454374 |
P(H) | 0.2480427 | 0.0146154 | 0.2193971 | 0.2766884 |
Numerous jackknife and bootstrap weight types are supported. See survey::svrrepdesign
for details.