PWD_outlier: Weighted Deming Regression - Outlier scanning

View source: R/PWD_outlier.r

PWD_outlierR Documentation

Weighted Deming Regression – Outlier scanning

Description

This function tests for outliers from the fitted regression, and refits on a sanitized data set (with outliers removed).

Usage

PWD_outlier(X, Y, K, lambda=1, Pcut=0.01, rho=NA, alpha=NA, beta=NA, mu=NA)

Arguments

X

the vector of predicate readings.

Y

the vector of test readings.

K

the maximum number of outliers to seek.

lambda

optional (default of 1) - the ratio of the X to the Y precision profile.

Pcut

optional, default 0.01 (1%), cutoff for statistical significance of Bonferroni P.

rho

optional (default of NA) - numeric, single value or vector, initial estimate(s) of \rho = \frac{\sigma}{\kappa}.

alpha

optional (default of NA) - numeric, single value, initial estimate of \alpha.

beta

optional (default of NA) - numeric, single value, initial estimate of \beta.

mu

optional (default of NA) - numeric, vector of length of X, initial estimate of \mu.

Details

The method is modeled on the Rosner sequential ESD outlier procedure and assumes the sample is large enough to ignore the effect of random variability in the parameter estimates on the distribution of the residuals.

Value

A list containing the following components:

ndrop

the number of significant outliers

drop

a vector of the indices of the outliers

cor

the Pearson correlation between X and Y

cleancor

the Pearson correlation between cleaned X and Y (after outliers removed)

scalr

the scaled residuals of all cases from the sanitized fit and whose normal tail areas provide the basis for the outlier P values

basepar

the sigma, kappa, alpha, beta of the full data set

lastpar

the sigma, kappa, alpha, beta of the sanitized data set

forward

dataframe summarizing the forward identification of possible outliers

backward

dataframe summarizing the backward reinclusion of cases

tee

the t statistics of the final identified outliers

BonP

the Bonferroni P-value of the final identified outliers

outlis

dataframe containing the outlier cases, test statistics, and P-values

Author(s)

Douglas M. Hawkins, Jessica J. Kraker krakerjj@uwec.edu

References

Hawkins DM and Kraker JJ (2026). Precision Profile Weighted Deming Regression for Methods Comparison. The Journal of Applied Laboratory Medicine, 11(2), 379-392. doi:10.1093/jalm/jfaf183

Hawkins DM (2008). Outliers in Wiley Encyclopedia of Clinical Trials, eds R. D’Agostino, L. Sullivan, and J. Massaro. Wiley, New York.

Examples

# library
library(ppwdeming)

# parameter specifications
sigma <- 1
kappa <- 0.08
alpha <- 1
beta  <- 1.1
true  <- 8*10^((0:99)/99)
truey <- alpha+beta*true
# simulate single sample - set seed for reproducibility
set.seed(1069)
# specifications for predicate method
X     <- sigma*rnorm(100)+true *(1+kappa*rnorm(100))
# specifications for test method
Y     <- sigma*rnorm(100)+truey*(1+kappa*rnorm(100))
# add some outliers
Y[c(1,2,100)] <- Y[c(1,2,100)] + c(-10,9,-50)

# check for outliers, re-fit, and store output
outliers_assess <- PWD_outlier(X, Y, K=5)


ppwdeming documentation built on March 16, 2026, 1:06 a.m.