PWD_outlier | R Documentation |
This function tests for outliers from the fitted regression, and refits on a sanitized data set (with outliers removed).
PWD_outlier(X, Y, K, lambda=1, Pcut=0.01, printem=FALSE)
X |
the vector of predicate readings, |
Y |
the vector of test readings, |
K |
the maximum number of outliers to seek, |
lambda |
optional the ratio of the X to the Y precision profile (defaults to 1), |
Pcut |
optional, default 0.01 (1%), cutoff for statistical significance of Bonferroni P, |
printem |
optional - if TRUE, routine will print out results as a |
The method is modeled on the Rosner sequential ESD outlier procedure and assumes the sample is large enough to assume normality of the predicted residuals.
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 |
keep |
logical vector identifying which cases retained in sanitized data set |
basepar |
the sigma, kappa, alpha, beta of the full data set |
lastpar |
the sigma, kappa, alpha, beta of the sanitized data set |
Douglas M. Hawkins, Jessica J. Kraker krakerjj@uwec.edu
Hawkins DM and Kraker JJ. Precision Profile Weighted Deming Regression for Methods Comparison, on Arxiv (2025) doi:10.48550/arXiv.2508.02888
Hawkins DM (2008). Outliers in Wiley Encyclopedia of Clinical Trials, eds R. D’Agostino, L. Sullivan, and J. Massaro. Wiley, New York.
# 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(1039)
# 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(7,4,-45)
# check for outliers, re-fit, and store output
outliers_assess <- PWD_outlier(X, Y, K=5, printem=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.