Title: | Diagnosis Performance Using Attributable Fraction |
---|---|
Description: | Estimate diagnosis performance (Sensitivity, Specificity, Positive predictive value, Negative predicted value) of a diagnostic test where can not measure the golden standard but can estimate it using the attributable fraction. |
Authors: | John J. Aponte [aut, cre] , Orvalho Augusto [aut] |
Maintainer: | John J. Aponte <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.1 |
Built: | 2024-11-03 04:36:15 UTC |
Source: | https://github.com/johnaponte/afdx |
The afdx package provides functions to estimate the attributable fraction using logit exponential model or bayesian latent class model.
The logitexp function estimated the logit exponential function fitting a maximum likelihood model. The senspec() function estimate the sensitivity, specificity, positive predicted value and negative predicted values for the specified cut-off points.
The get_latent_model() provides an rjags model template to estimate the attributable fraction and the sensitivity, specificity, positive predicted value and negative predicted value of the latent class model.
@docType package @name afdx
Maintainer: John J. Aponte [email protected] (ORCID)
Authors:
Orvalho Augusto [email protected] (ORCID)
Useful links:
This function returns a template that can be use as model in an rjags
model
it requires two vectors with the number of subjects in the symptoms,
like fever in the case of malaria (n) and the number of non-symptomatic (m)
in each of the categories of results of the diagnostic test. The first
category is reserved for the negatives by the diagnostic test (in the malaria
case those with asexual density 0) and the rest categories each one with
higher values than the previous category.
get_latent_model()
get_latent_model()
See: Smith T, Vounatsou P. Logistic regression and latent class models for estimating positivities in diagnostic assays with poor resolution. Communications in Statistics - Theory and Methods. 1997 Jan;26(7):1677–700.
Vounatsou P, Smith T, Smith AFM. Bayesian analysis of two-component mixture distributions applied to estimating malaria attributable fractions. Journal of the Royal Statistical Society: Series C (Applied Statistics). 1998;47(4):575–87.
Müller I, Genton B, Rare L, Kiniboro B, Kastens W, Zimmerman P, et al. Three different Plasmodium species show similar patterns of clinical tolerance of malaria infection. Malar J. 2009;8(1):158.
Plucinski MM, Rogier E, Dimbu PR, Fortes F, Halsey ES, Aidoo M, et al. Performance of Antigen Concentration Thresholds for Attributing Fever to Malaria among Outpatients in Angola. J Clin Microbiol. 2019;57(3).
a string value
{ get_latent_model() }
{ get_latent_model() }
Fit a logit model of v.density on v.fever v.density with a exponential coefficient for the v.density
logitexp(v.fever, v.density)
logitexp(v.fever, v.density)
v.fever |
numeric vector of 0/1 indicating fever or equivalent |
v.density |
numeric vector of values >= 0 indicating the density |
logit(v.fever) ~ beta * (v. density ^ tau)
This corresponds to the model 3 describe by Smith, T., Schellenberg, J.A., Hayes, R., 1994. Attributable fraction estimates and case definitions for malaria in endemic areas. Stat Med 13, 2345–2358.
S3 object of class afmodel with 4 components: data, model, coefficients and the estimated attributable fraction.
{ # Get the sample data head(malaria_df1) fit <- logitexp(malaria_df1$fever, malaria_df1$density) fit senspec(fit, c(1,100,500,1000,2000,4000,8000,16000, 32000,54000,100000)) }
{ # Get the sample data head(malaria_df1) fit <- logitexp(malaria_df1$fever, malaria_df1$density) fit senspec(fit, c(1,100,500,1000,2000,4000,8000,16000, 32000,54000,100000)) }
Generate the cutoffs at every change of density in the fever, but first category is for density 0, and last category if possible have no subjects with no fever.
make_cutoffs(v.fever, v.density, add1 = TRUE)
make_cutoffs(v.fever, v.density, add1 = TRUE)
v.fever |
numeric vector of 0/1 indicating fever or equivalent |
v.density |
numeric vector of values >= 0 indicating the density |
add1 |
a logical value to indicate the category started with 1 is included |
a vector with the cutoff points
{ make_cutoffs(malaria_df1$fever, malaria_df1$density, add1 = TRUE) }
{ make_cutoffs(malaria_df1$fever, malaria_df1$density, add1 = TRUE) }
Generate the categories in a way that each category have at least the
mintot
number of observation. It generate all possible categories
were there is change and then collapse to have minimum number of observations
in each category
make_n_cutoffs(v.fever, v.density, mintot, add1 = TRUE)
make_n_cutoffs(v.fever, v.density, mintot, add1 = TRUE)
v.fever |
numeric vector of 0/1 indicating fever or equivalent |
v.density |
numeric vector of values >= 0 indicating the density |
mintot |
minimum number of observations per category |
add1 |
a logical value to indicate the category started with 1 is included |
a vector with the cutoff points
{ make_n_cutoffs(malaria_df1$fever, malaria_df1$density, mintot=50) }
{ make_n_cutoffs(malaria_df1$fever, malaria_df1$density, mintot=50) }
Simulated data with the main outcomes of a malaria crossectional, fever and parasite density
malaria_df1
malaria_df1
a dataset with two variables
1 if fever or history of fever, 0 otherwise
asexual Plasmodium parasite density, in parasites per ul
Simulated data with the main outcomes of a malaria crossectional, fever and parasite density
malaria_df2
malaria_df2
a dataset with two variables
1 if fever or history of fever, 0 otherwise
asexual Plasmodium parasite density, in parasites per ul
Estimate sensitivity, specificity, positive predicted value and negative predicted value negative predictive value from an afmodel. The estimated "true" negative and "true" positive are estimated using the estimated overall attributable fraction and the predictive positive value associated with each cut-off point as described by Smith, T., Schellenberg, J.A., Hayes, R., 1994. Attributable fraction estimates and case definitions for malaria in endemic areas. Stat Med 13, 2345–2358.
senspec(object, ...) ## Default S3 method: senspec(object, ...) ## S3 method for class 'afmodel' senspec(object, cutoff, ...)
senspec(object, ...) ## Default S3 method: senspec(object, ...) ## S3 method for class 'afmodel' senspec(object, cutoff, ...)
object |
with the data to calculate the sensitivity and specificity |
... |
other parameters for the implementing functions |
cutoff |
vector of cut-off points to make the estimations |
a matrix with the columns sensitivity and specificity, ppv (positive predicted value) and npv (negative predicted value)
No return value. Raise an error.
a matrix with the columns sensitivity and specificity, ppv (positive predicted value) and npv (negative predicted value)
{ # Get the sample data head(malaria_df1) fit <- logitexp(malaria_df1$fever, malaria_df1$density) fit senspec(fit, c(1,100,500,1000,2000,4000,8000,16000, 32000,54000,100000)) }
{ # Get the sample data head(malaria_df1) fit <- logitexp(malaria_df1$fever, malaria_df1$density) fit senspec(fit, c(1,100,500,1000,2000,4000,8000,16000, 32000,54000,100000)) }