Get enhanced estimate and variance (Bannick and Gao 2023+). This is an estimator similar to the adjusted estimator, but including optional prior HIV test results.

estEnhanced(
  n_p,
  n,
  ptdf,
  beta,
  beta_var,
  big_T,
  phidat,
  use_geese,
  formula,
  family,
  plot_phi = TRUE,
  return_all = FALSE,
  ...
)

Arguments

n_p

Number of positives

n

Number of observations

ptdf

Prior testing data frame. Only include those who are positive.

beta

False recency rate (FRR)

beta_var

Variance of the estimator for FRR (or 0 if FRR known)

big_T

The \(T^*\) in the equation above

phidat

Data to fit a modfunc model to. Must have column names ri for recency indicator and ui for infection duration. Can have more columns, e.g., if an id is needed for geese.

use_geese

Indicator to fit a gee model using geese(), or a glm model with glm()

formula

Formula for fitting the model to phidat. Formula argument must take in only ui as the newdata. For example, do not create a ui^2 variable. Use poly(ui, ...) function to fit polynomial terms.

family

Family argument for glm or gee

plot_phi

Whether to plot the estimated phi function

return_all

Return information to be used internally (not for general usage)

Value

Returns a list of the estimate and the variance, or more:

est

incidence estimate

var

estimate of variance

omega

estimate of MDRI using phidat and model specs

omega_var

estimate of variance of MDRI using phidat and model specs

n_r

number of recent infections identified based on recency assay alone, from ptdf

n_r_pt

number of recent infections after applying enhanced algorithm using prior tests

q_eff

number of HIV-pos individuals with recency assay results + prior tests / recency assay results

q

fraction of HIV-pos individuals with recency assay results / HIV-pos individuals

Details

For example of usage, see the enhanced estimator vignette("enhanced", package = "XSRecency")