Learn R Programming

valytics (version 0.4.0)

plot.precision_study: Plot method for precision_study objects

Description

Creates visualizations for precision study results. Multiple plot types are available: variance component chart, CV profile across samples, and precision estimates summary.

Usage

# S3 method for precision_study
plot(
  x,
  type = c("variance", "cv", "precision"),
  show_ci = TRUE,
  colors = NULL,
  title = NULL,
  ...
)

# S3 method for precision_study autoplot( object, type = c("variance", "cv", "precision"), show_ci = TRUE, colors = NULL, title = NULL, ... )

Value

A ggplot object that can be further customized.

Arguments

x

An object of class precision_study.

type

Character; type of plot to create:

  • "variance" (default): Bar chart showing variance components as percentage of total variance

  • "cv": CV profile across samples (requires multi-sample data)

  • "precision": Forest plot of precision estimates with CIs

show_ci

Logical; if TRUE (default), displays confidence intervals where applicable.

colors

Character vector of colors for the plot elements. If NULL, uses a default color palette.

title

Character; plot title. If NULL (default), generates an automatic title.

...

Additional arguments (currently ignored).

object

An object of class precision_study.

Details

Variance component chart (type = "variance"): Displays the proportion of total variance attributable to each source (between-day, between-run, error/repeatability). Helps identify which factors contribute most to measurement variability.

CV profile (type = "cv"): For multi-sample studies, displays how CV varies across concentration levels. Typically CV is higher at low concentrations. Requires data from multiple samples/levels.

Precision summary (type = "precision"): Forest plot showing precision estimates (repeatability, intermediate precision, reproducibility) with confidence intervals.

See Also

precision_study() for performing the analysis, summary.precision_study() for detailed results

Examples

Run this code
# Create example data
set.seed(42)
prec_data <- data.frame(
  day = rep(1:5, each = 6),
  run = rep(rep(1:2, each = 3), 5),
  value = rnorm(30, mean = 100, sd = 5)
)
prec_data$value <- prec_data$value + rep(rnorm(5, 0, 3), each = 6)

prec <- precision_study(prec_data, value = "value", day = "day", run = "run")

# Variance component chart (default)
plot(prec)
plot(prec, type = "variance")

# Precision estimates with CIs
plot(prec, type = "precision")

Run the code above in your browser using DataLab