Learn R Programming

valytics (version 0.4.0)

verify_precision: Precision Verification Against Manufacturer Claims

Description

Compares observed precision (CV or SD) to manufacturer's claimed performance using statistical hypothesis testing. This function implements verification protocols for validating that an analytical method meets specified precision goals.

Usage

verify_precision(
  x,
  claimed_cv = NULL,
  claimed_sd = NULL,
  mean_value = NULL,
  alpha = 0.05,
  alternative = c("less", "two.sided", "greater"),
  conf_level = 0.95,
  value = "value",
  day = "day",
  run = NULL,
  ...
)

Value

An object of class c("verify_precision", "valytics_precision", "valytics_result"), which is a list containing:

input

List with input data and metadata:

  • n: Number of observations

  • df: Degrees of freedom for the test

  • mean_value: Mean of measurements

  • source: Description of input source

observed

List with observed precision:

  • sd: Observed standard deviation

  • cv_pct: Observed CV (percent)

  • variance: Observed variance

claimed

List with manufacturer's claimed precision:

  • sd: Claimed SD

  • cv_pct: Claimed CV (percent)

  • variance: Claimed variance

test

List with hypothesis test results:

  • statistic: Chi-square test statistic

  • df: Degrees of freedom

  • p_value: P-value

  • alternative: Alternative hypothesis used

  • method: Test method description

verification

List with verification outcome:

  • verified: Logical; TRUE if precision is verified

  • ratio: Ratio of observed variance to claimed variance

  • cv_ratio: Ratio of observed CV to claimed CV

  • upper_verification_limit: Upper limit for verification

ci

List with confidence intervals:

  • sd_ci: CI for standard deviation

  • cv_ci: CI for CV (percent)

  • variance_ci: CI for variance

settings

List with analysis settings

call

The matched function call

Arguments

x

Either a numeric vector of measurements, a precision_study object, or a data frame containing precision study data.

claimed_cv

Manufacturer's claimed coefficient of variation (as percent). Either claimed_cv or claimed_sd must be provided.

claimed_sd

Manufacturer's claimed standard deviation. Either claimed_cv or claimed_sd must be provided.

mean_value

Mean concentration of the sample. Required when x is a numeric vector and claimed_cv is used, or when claimed_sd is used and CV-based comparison is desired.

alpha

Significance level for the hypothesis test (default: 0.05).

alternative

Type of alternative hypothesis: "less" (default) tests if observed is not worse than claimed, "two.sided" tests for any difference, "greater" tests if observed is worse than claimed.

conf_level

Confidence level for intervals (default: 0.95).

value

Character string specifying the column name containing measurement values when x is a data frame. Default is "value".

day

Character string specifying the column name for day identifier when x is a data frame. Default is "day".

run

Character string specifying the column name for run identifier when x is a data frame. Default is NULL.

...

Additional arguments passed to precision_study() when x is a data frame.

Input Options

The function accepts three types of input:

  • Numeric vector: Raw measurements (simplest case)

  • precision_study object: Uses within-laboratory precision from a previous analysis

  • Data frame: Runs precision_study() internally with specified factors

Details

Statistical Test:

The verification uses a chi-square test comparing observed variance to claimed variance:

$$\chi^2 = \frac{(n-1) \cdot s^2}{\sigma^2_{claimed}}$$

where \(s^2\) is the observed sample variance and \(\sigma^2_{claimed}\) is the manufacturer's claimed variance.

Hypothesis Testing:

For alternative = "less" (default, recommended for verification):

  • H0: True precision is worse than or equal to claimed

  • H1: True precision is better than or equal to claimed

  • Verification passes if observed precision is not significantly worse

For typical verification studies, the observed CV should not exceed the manufacturer's claimed CV by more than expected from sampling variability.

Verification Limit:

The upper verification limit (UVL) represents the maximum observed CV that would still be consistent with the claimed CV at the given significance level:

$$UVL = CV_{claimed} \cdot \sqrt{\frac{\chi^2_{1-\alpha, df}}{df}}$$

If observed CV <= UVL, precision is verified.

References

Chesher D (2008). Evaluating assay precision. Clinical Biochemist Reviews, 29(Suppl 1):S23-S26.

ISO 5725-6:1994. Accuracy (trueness and precision) of measurement methods and results - Part 6: Use in practice of accuracy values.

See Also

precision_study() for full precision analysis, ate_assessment() for total error assessment

Examples

Run this code
# Example 1: Verify precision from raw measurements
set.seed(42)
measurements <- rnorm(25, mean = 100, sd = 3.5)

# Manufacturer claims CV = 4%
result <- verify_precision(measurements, claimed_cv = 4, mean_value = 100)
print(result)

# Example 2: Verify precision from a precision_study object
prec_data <- data.frame(
  day = rep(1:5, each = 5),
  value = rnorm(25, mean = 100, sd = 3)
)
prec_data$value <- prec_data$value + rep(rnorm(5, 0, 1.5), each = 5)

prec <- precision_study(prec_data, value = "value", day = "day")
result <- verify_precision(prec, claimed_cv = 5)
print(result)

# Example 3: Verify precision directly from data frame
result <- verify_precision(
  prec_data,
  claimed_cv = 5,
  value = "value",
  day = "day"
)
print(result)

Run the code above in your browser using DataLab