WD_General: Weighted Deming Regression

View source: R/WD_General.r

WD_GeneralR Documentation

Weighted Deming Regression

Description

This code fits the weighted Deming regression on predicate readings (X) and test readings (Y).

Usage

WD_General(X, Y, g, h, epsilon=1e-10)

Arguments

X

the vector of predicate readings,

Y

the vector of test readings,

g

the vector of variances of the X,

h

the vector of variances of the Y,

epsilon

optional convergence tolerance limit.

Details

For input vectors g and h containing the variances of predicate readings X and test readings Y, respectively, iteratively fits weighted Deming regression.

Value

A list containing the following components:

alpha

the fitted intercept

beta

the fitted slope

cor

the Pearson correlation between X and Y

fity

the vector of predicted Y

mu

the vector of estimated latent true values

resi

the vector of residuals

like

the -2 log likelihood L

innr

the number of inner refinement loops executed

Author(s)

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

References

Ripley BD and Thompson M (1987). Regression techniques for the detection of analytical bias. Analyst, 112, 377-383.

Examples

# library
library(ppwdeming)

# parameter specifications
alpha <- 1
beta  <- 1.1
true  <- 8*10^((0:99)/99)
truey <- alpha+beta*true
# Loosely motivated by Vitamin D data set
g     <- 4e-16+0.07*true^1.27
h     <- 6e-2+7e-5*truey^2.2

# simulate single sample - set seed for reproducibility
set.seed(1039)
# specifications for predicate method
X     <- true +sqrt(g)*rnorm(100)
# specifications for test method
Y     <- truey+sqrt(h)*rnorm(100)

# fit with to estimate linear parameters
wd_fit <- WD_General(X,Y,g,h)
cat("\nWith given g and h, the estimated intercept is",
    signif(wd_fit$alpha,4), "and the estimated slope is",
    signif(wd_fit$beta,4), "\n")


ppwdeming documentation built on Sept. 9, 2025, 5:37 p.m.