| plot.deming_regression | R Documentation |
Creates publication-ready plots for Deming regression results. Multiple plot types are available: scatter plot with regression line and residual plot.
## S3 method for class 'deming_regression'
plot(
x,
type = c("scatter", "residuals"),
show_ci = TRUE,
show_identity = TRUE,
residual_type = c("fitted", "rank"),
point_alpha = 0.6,
point_size = 2,
line_colors = NULL,
title = NULL,
xlab = NULL,
ylab = NULL,
...
)
## S3 method for class 'deming_regression'
autoplot(
object,
type = c("scatter", "residuals"),
show_ci = TRUE,
show_identity = TRUE,
residual_type = c("fitted", "rank"),
point_alpha = 0.6,
point_size = 2,
line_colors = NULL,
title = NULL,
xlab = NULL,
ylab = NULL,
...
)
x |
An object of class |
type |
Character; type of plot to create:
|
show_ci |
Logical; if |
show_identity |
Logical; if |
residual_type |
Character; for |
point_alpha |
Numeric; transparency of points (0-1, default: 0.6). |
point_size |
Numeric; size of points (default: 2). |
line_colors |
Named character vector with colors for |
title |
Character; plot title. If |
xlab, ylab |
Character; axis labels. If |
... |
Additional arguments (currently ignored). |
object |
An object of class |
Scatter plot (type = "scatter"):
Displays the raw data with the fitted Deming regression line and
optional confidence band. The identity line (y = x) is shown for reference.
If the regression line overlaps substantially with the identity line, the
methods are in good agreement.
Residual plot (type = "residuals"):
Displays perpendicular residuals. Look for:
Random scatter around zero (good)
Patterns or trends (suggests non-linearity)
Funnel shape (suggests heteroscedasticity)
A ggplot object that can be further customized.
deming_regression() for performing the analysis,
summary.deming_regression() for detailed results
set.seed(42)
true_vals <- rnorm(50, 100, 20)
method_a <- true_vals + rnorm(50, sd = 5)
method_b <- 1.05 * true_vals + 3 + rnorm(50, sd = 5)
dm <- deming_regression(method_a, method_b)
# Scatter plot with regression line
plot(dm)
# Without identity line
plot(dm, show_identity = FALSE)
# Residual plot
plot(dm, type = "residuals")
# Residuals by rank
plot(dm, type = "residuals", residual_type = "rank")
# Customized appearance
plot(dm, point_size = 3, title = "Glucose: POC vs Reference")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.