Skip to contents

Analysis of diagnostic tests without a gold standard reference using multiple statistical approaches. Implements Latent Class Analysis (Hui & Walter, 1980), Bayesian methods (Joseph et al., 1995), and composite reference standards for estimating test performance when no perfect reference test exists.

Usage

nogoldstandard(
  data,
  clinicalPreset = "none",
  test1,
  test1Positive,
  test2,
  test2Positive,
  test3 = NULL,
  test3Positive,
  test4 = NULL,
  test4Positive,
  test5 = NULL,
  test5Positive,
  method = "all_positive",
  bootstrap = FALSE,
  nboot = 1000,
  alpha = 0.05,
  verbose = FALSE
)

Arguments

data

The data as a data frame.

clinicalPreset

Predefined clinical scenarios with optimized settings and method recommendations.

test1

First diagnostic test variable.

test1Positive

The positive level for Test 1.

test2

Second diagnostic test variable.

test2Positive

The positive level for Test 2.

test3

Third diagnostic test variable (optional).

test3Positive

The positive level for Test 3.

test4

Fourth diagnostic test variable (optional).

test4Positive

The positive level for Test 4.

test5

Fifth diagnostic test variable (optional).

test5Positive

The positive level for Test 5.

method

Method for analyzing tests without gold standard.

bootstrap

Calculate bootstrap confidence intervals.

nboot

Number of bootstrap samples for confidence intervals.

alpha

Alpha level for confidence intervals.

verbose

Show detailed progress messages during bootstrap analysis.

Value

A results object containing:

results$instructionsa html
results$clinical_summarya html
results$method_guidea html
results$prevalencea table
results$test_metricsa table
results$model_fita table
results$crosstaba table
results$agreement_plotan image
results$agreement_plot2an image

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$prevalence$asDF

as.data.frame(results$prevalence)

Examples

# \donttest{
# Basic example with simulated diagnostic test data
set.seed(123)
n <- 200

# Simulate disease status (latent, unknown)
disease <- rbinom(n, 1, 0.3)  # 30\% prevalence

# Simulate test results with known sensitivity/specificity
test1_result <- ifelse(disease == 1,
                       rbinom(sum(disease), 1, 0.85),     # sensitivity 0.85
                       rbinom(sum(1-disease), 1, 0.15))   # 1-specificity 0.15
test1_result <- factor(test1_result, levels=c(0,1), labels=c("Negative", "Positive"))

test2_result <- ifelse(disease == 1,
                       rbinom(sum(disease), 1, 0.80),     # sensitivity 0.80
                       rbinom(sum(1-disease), 1, 0.10))   # 1-specificity 0.10
test2_result <- factor(test2_result, levels=c(0,1), labels=c("Negative", "Positive"))

# Create data frame
test_data <- data.frame(
    Test1 = test1_result,
    Test2 = test2_result
)

# Latent Class Analysis (recommended method)
nogoldstandard(
    data = test_data,
    test1 = "Test1",
    test1Positive = "Positive",
    test2 = "Test2",
    test2Positive = "Positive",
    method = "latent_class"
)
#> Error in nogoldstandard(data = test_data, test1 = "Test1", test1Positive = "Positive",     test2 = "Test2", test2Positive = "Positive", method = "latent_class"): argument "test3Positive" is missing, with no default

# With bootstrap confidence intervals
nogoldstandard(
    data = test_data,
    test1 = "Test1",
    test1Positive = "Positive",
    test2 = "Test2",
    test2Positive = "Positive",
    method = "latent_class",
    bootstrap = TRUE,
    nboot = 500,
    verbose = TRUE
)
#> Error in nogoldstandard(data = test_data, test1 = "Test1", test1Positive = "Positive",     test2 = "Test2", test2Positive = "Positive", method = "latent_class",     bootstrap = TRUE, nboot = 500, verbose = TRUE): argument "test3Positive" is missing, with no default
# }