Skip to contents

Calculates repeatability statistics for replicate measurements performed under identical conditions (same operator, instrument, short time interval).

Usage

measure_repeatability(data, response_col, group_col = NULL, conf_level = 0.95)

Arguments

data

A data frame containing replicate measurements.

response_col

Name of the column containing the response values.

group_col

Optional name of a grouping column (e.g., concentration level). If provided, repeatability is calculated within each group.

conf_level

Confidence level for intervals. Default is 0.95.

Value

A measure_precision object containing:

  • mean: Mean of the replicates

  • sd: Standard deviation

  • cv: Coefficient of variation (%)

  • n: Number of replicates

  • se: Standard error

  • ci_lower, ci_upper: Confidence interval for the mean

Details

Repeatability represents the precision of a method under constant conditions over a short time interval. It is typically assessed using at least 6 replicates of a sample at each concentration level of interest.

The coefficient of variation (CV) is reported as a percentage: CV = 100 * SD / mean

Examples

# Simple repeatability from replicate measurements
data <- data.frame(
  sample_id = rep("QC1", 10),
  concentration = rnorm(10, mean = 100, sd = 2)
)
measure_repeatability(data, "concentration")
#> measure_precision: repeatability 
#> ──────────────────────────────────────────────────────────────────────────────── 
#>   n = 10 
#>   Mean = 99.38 
#>   SD = 1.9 
#>   CV = 1.9 %
#>   95% CI: [98.02, 100.7]

# Repeatability at multiple concentration levels
data <- data.frame(
  level = rep(c("low", "mid", "high"), each = 6),
  concentration = c(
    rnorm(6, 10, 0.5),
    rnorm(6, 50, 2),
    rnorm(6, 100, 4)
  )
)
measure_repeatability(data, "concentration", group_col = "level")
#> measure_precision: repeatability 
#> ──────────────────────────────────────────────────────────────────────────────── 
#> 
#> Group: low 
#>   n = 6 
#>   Mean = 10.19 
#>   SD = 0.2589 
#>   CV = 2.5 %
#>   95% CI: [9.915, 10.46]
#> 
#> Group: mid 
#>   n = 6 
#>   Mean = 49.33 
#>   SD = 2.66 
#>   CV = 5.4 %
#>   95% CI: [46.54, 52.12]
#> 
#> Group: high 
#>   n = 6 
#>   Mean = 101.5 
#>   SD = 4.006 
#>   CV = 3.9 %
#>   95% CI: [97.32, 105.7]