View source: R/verify_precision.R
| verify_precision | R Documentation |
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.
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,
...
)
x |
Either a numeric vector of measurements, a |
claimed_cv |
Manufacturer's claimed coefficient of variation (as percent).
Either |
claimed_sd |
Manufacturer's claimed standard deviation. Either |
mean_value |
Mean concentration of the sample. Required when |
alpha |
Significance level for the hypothesis test (default: 0.05). |
alternative |
Type of alternative hypothesis:
|
conf_level |
Confidence level for intervals (default: 0.95). |
value |
Character string specifying the column name containing
measurement values when |
day |
Character string specifying the column name for day identifier
when |
run |
Character string specifying the column name for run identifier
when |
... |
Additional arguments passed to |
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.
An object of class c("verify_precision", "valytics_precision", "valytics_result"),
which is a list containing:
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
List with observed precision:
sd: Observed standard deviation
cv_pct: Observed CV (percent)
variance: Observed variance
List with manufacturer's claimed precision:
sd: Claimed SD
cv_pct: Claimed CV (percent)
variance: Claimed variance
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
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
List with confidence intervals:
sd_ci: CI for standard deviation
cv_ci: CI for CV (percent)
variance_ci: CI for variance
List with analysis settings
The matched function call
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
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.
precision_study() for full precision analysis,
ate_assessment() for total error assessment
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.