View source: R/precision_profile.R
| precision_profile | R Documentation |
Constructs a precision profile (CV vs concentration relationship) from precision study results and estimates functional sensitivity. The precision profile characterizes how measurement imprecision changes across the analytical measurement interval.
precision_profile(
x,
concentration = "concentration",
cv = "cv_pct",
model = c("hyperbolic", "linear"),
cv_targets = c(10, 20),
conf_level = 0.95,
bootstrap = FALSE,
boot_n = 1999
)
x |
An object of class |
concentration |
Character string specifying the column name for
concentration values (only used if |
cv |
Character string specifying the column name for CV values (only
used if |
model |
Regression model for CV-concentration relationship:
|
cv_targets |
Numeric vector of target CV percentages for functional
sensitivity estimation. Default is |
conf_level |
Confidence level for prediction intervals (default: 0.95). |
bootstrap |
Logical; if |
boot_n |
Number of bootstrap resamples when |
Precision Profile:
The precision profile describes how analytical imprecision (CV) varies across the analytical measurement interval. Typically, CV decreases as concentration increases, following a hyperbolic relationship.
Hyperbolic Model:
The hyperbolic model is:
CV = \sqrt{a^2 + (b/x)^2}
where:
a represents the asymptotic CV at high concentrations
b represents the concentration-dependent component
x is the analyte concentration
This model captures the characteristic behavior where CV approaches a constant value at high concentrations and increases hyperbolically at low concentrations.
Linear Model:
The linear model is:
CV = a + b/x
This is a simpler alternative that may be appropriate when the relationship is approximately linear when plotted as CV vs 1/concentration.
Functional Sensitivity:
Functional sensitivity is defined as the lowest concentration at which a measurement procedure achieves a specified level of precision (CV). Common thresholds are:
10% CV: Modern standard for high-sensitivity assays (e.g., cardiac troponin)
20% CV: Traditional standard (originally defined for TSH assays)
The functional sensitivity is calculated by solving the fitted model equation for the concentration that yields the target CV.
An object of class c("precision_profile", "valytics_precision", "valytics_result"),
which is a list containing:
List with original data:
concentration: Numeric vector of concentrations
cv: Numeric vector of CV values (percent)
n_levels: Number of concentration levels
conc_range: Concentration range (min, max)
conc_span: Fold-difference (max/min)
List with fitted model information:
type: Model type ("hyperbolic" or "linear")
parameters: Named vector of fitted parameters
equation: Character string describing the fitted equation
Data frame with fitted values:
concentration: Concentration values
cv_observed: Observed CV values
cv_fitted: Model-fitted CV values
residual: Residuals (observed - fitted)
ci_lower: Lower prediction interval
ci_upper: Upper prediction interval
List with goodness-of-fit statistics:
r_squared: Coefficient of determination
adj_r_squared: Adjusted R-squared
rmse: Root mean squared error
mae: Mean absolute error
Data frame with functional sensitivity estimates:
cv_target: Target CV percentage
concentration: Estimated concentration at target CV
ci_lower: Lower confidence limit (if bootstrap)
ci_upper: Upper confidence limit (if bootstrap)
achievable: Logical; TRUE if target CV is achievable
List with analysis settings
The matched function call
At least 4 concentration levels
Concentration span of at least 2-fold (warning if less)
Valid CV estimates at each level (from precision study)
Armbruster DA, Pry T (2008). Limit of blank, limit of detection and limit of quantitation. Clinical Biochemist Reviews, 29(Suppl 1):S49-S52.
CLSI EP17-A2 (2012). Evaluation of Detection Capability for Clinical Laboratory Measurement Procedures; Approved Guideline - Second Edition. Clinical and Laboratory Standards Institute, Wayne, PA.
Kroll MH, Emancipator K (1993). A theoretical evaluation of linearity. Clinical Chemistry, 39(3):405-413.
precision_study() for variance component analysis,
plot.precision_profile() for visualization
# Example with simulated multi-level precision data
set.seed(42)
# Generate data for 6 concentration levels
conc_levels <- c(5, 10, 25, 50, 100, 200)
n_levels <- length(conc_levels)
prec_data <- data.frame()
for (i in seq_along(conc_levels)) {
level_data <- expand.grid(
level = conc_levels[i],
day = 1:5,
replicate = 1:5
)
# Simulate CV that decreases with concentration
true_cv <- sqrt(3^2 + (20/conc_levels[i])^2)
level_data$value <- conc_levels[i] * rnorm(
nrow(level_data),
mean = 1,
sd = true_cv/100
)
prec_data <- rbind(prec_data, level_data)
}
# Run precision study
prec <- precision_study(
data = prec_data,
value = "value",
sample = "level",
day = "day"
)
# Generate precision profile
profile <- precision_profile(prec)
print(profile)
summary(profile)
# Hyperbolic model with bootstrap CIs
profile_boot <- precision_profile(
prec,
model = "hyperbolic",
cv_targets = c(10, 20),
bootstrap = TRUE,
boot_n = 499
)
# Linear model
profile_linear <- precision_profile(prec, model = "linear")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.