View source: R/pb_regression.R
| pb_regression | R Documentation |
Performs Passing-Bablok regression to assess agreement between two measurement
methods. This non-parametric regression method is robust to outliers and does
not assume normally distributed errors. The implementation uses a fast
O(n log n) algorithm from the robslopes package for point estimation.
pb_regression(
x,
y = NULL,
data = NULL,
conf_level = 0.95,
ci_method = c("analytical", "bootstrap"),
boot_n = 1999,
na_action = c("omit", "fail")
)
x |
Numeric vector of measurements from method 1 (reference method),
or a formula of the form |
y |
Numeric vector of measurements from method 2 (test method).
Ignored if |
data |
Optional data frame containing the variables specified in
|
conf_level |
Confidence level for intervals (default: 0.95). |
ci_method |
Method for calculating confidence intervals:
|
boot_n |
Number of bootstrap resamples when |
na_action |
How to handle missing values: |
Passing-Bablok regression is a non-parametric method for fitting a linear relationship between two measurement methods. Unlike ordinary least squares, it:
Makes no assumptions about error distribution
Accounts for measurement error in both variables
Is robust to outliers
Produces results independent of which variable is assigned to X or Y (when using the equivariant form)
The slope is estimated as the median of all pairwise slopes (in absolute
value for the equivariant version), and the intercept is the median of
y - slope * x.
An object of class c("pb_regression", "valytics_comparison", "valytics_result"),
which is a list containing:
List with original data and metadata:
x, y: Numeric vectors (after NA handling)
n: Number of paired observations
n_excluded: Number of pairs excluded due to NAs
var_names: Named character vector with variable names
List with statistical results:
intercept: Intercept point estimate
slope: Slope point estimate
intercept_ci: Named numeric vector with lower and upper CI
slope_ci: Named numeric vector with lower and upper CI
residuals: Perpendicular residuals
fitted_x: Fitted x values
fitted_y: Fitted y values
List with CUSUM linearity test results (if calculable):
statistic: CUSUM test statistic
critical_value: Critical value at alpha = 0.05
p_value: Approximate p-value
linear: Logical; TRUE if linearity assumption holds
List with analysis settings:
conf_level: Confidence level used
ci_method: CI method used
boot_n: Number of bootstrap samples (if applicable
The matched function call.
Slope = 1: No proportional difference between methods
Slope != 1: Proportional (multiplicative) difference exists
Intercept = 0: No constant difference between methods
Intercept != 0: Constant (additive) difference exists
Use the confidence intervals to test these hypotheses: if 1 is within the slope CI and 0 is within the intercept CI, the methods are considered equivalent.
Linear relationship between X and Y (test with CUSUM)
Measurement range covers the intended clinical range
Data are continuously distributed
The CUSUM (cumulative sum) test checks the linearity assumption. A significant result (p < 0.05) suggests non-linearity, and Passing-Bablok regression may not be appropriate.
Passing H, Bablok W (1983). A new biometrical procedure for testing the equality of measurements from two different analytical methods. Application of linear regression procedures for method comparison studies in clinical chemistry, Part I. Journal of Clinical Chemistry and Clinical Biochemistry, 21(11):709-720. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1515/cclm.1983.21.11.709")}
Passing H, Bablok W (1984). Comparison of several regression procedures for method comparison studies and determination of sample sizes. Application of linear regression procedures for method comparison studies in Clinical Chemistry, Part II. Journal of Clinical Chemistry and Clinical Biochemistry, 22(6):431-445. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1515/cclm.1984.22.6.431")}
Bablok W, Passing H, Bender R, Schneider B (1988). A general regression procedure for method transformation. Application of linear regression procedures for method comparison studies in clinical chemistry, Part III. Journal of Clinical Chemistry and Clinical Biochemistry, 26(11):783-790. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1515/cclm.1988.26.11.783")}
Raymaekers J, Dufey F (2022). Equivariant Passing-Bablok regression in quasilinear time. arXiv preprint. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2202.08060")}
plot.pb_regression() for visualization,
summary.pb_regression() for detailed summary,
ba_analysis() for Bland-Altman analysis
# Simulated method comparison data
set.seed(42)
method_a <- rnorm(50, mean = 100, sd = 15)
method_b <- 1.05 * method_a + 3 + rnorm(50, sd = 5) # slope=1.05, intercept=3
# Basic analysis
pb <- pb_regression(method_a, method_b)
pb
# Using formula interface with data frame
df <- data.frame(reference = method_a, test = method_b)
pb <- pb_regression(reference ~ test, data = df)
# With bootstrap confidence intervals
pb_boot <- pb_regression(method_a, method_b, ci_method = "bootstrap")
# Using package example data
data(glucose_methods)
pb <- pb_regression(reference ~ poc_meter, data = glucose_methods)
summary(pb)
plot(pb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.