PWD_known: Weighted Deming Regression - general weights

View source: R/PWD_known.r

PWD_knownR Documentation

Weighted Deming Regression – general weights

Description

This code is used for the setting of known precision profiles implemented in user-provided R functions called gfun and hfun.

Usage

PWD_known(X, Y, gfun, hfun, gparms, hparms, epsilon=1e-10,
          MDL=NA, getCI=TRUE, printem=FALSE)

Arguments

X

the vector of predicate readings,

Y

the vector of test readings,

gfun

a function with two arguments, a vector of size n and a vector of parameters,

hfun

a function with two arguments, a vector of size n and a vector of parameters,

gparms

a numeric vector containing any parameters referenced by gfun,

hparms

a numeric vector containing any parameters referenced by hfun,

epsilon

optional convergence tolerance limit,

MDL

optional medical decision level(s),

getCI

optional - allows for jackknifed standard errors on the regression and MDL,

printem

optional - if TRUE, routine will print out results as a message.

Details

The functions gfun and hfun are allowed as inputs, to support flexibility in specification of the forms of these variance functions. The known precision profiles specified by the functions gfun and hfun, when provided with estimated vectors of \mu and \alpha + \beta\mu respectively and with any required parameters, will produce the vectors g and h. These vectors are then integrated into the iterative estimation of the slope and intercept of the linear relationship between predicate and test readings.

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

scalr

the vector of scaled residuals using the specified g and h

like

the -2 log likelihood L

sealpha

the jackknife standard error of alpha

sebeta

the jackknife standard error of beta

covar

the jackknife covariance between alpha and beta

preMDL

the predictions at the MDL(s)

preMDLl

the lower confidence limit(s) of preMDL

preMDLu

the upper confidence limit(s) of preMDL

Author(s)

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

Examples

# library
library(ppwdeming)

# parameter specifications
alpha <- 1
beta  <- 1.1
true  <- 8*10^((0:99)/99)
truey <- alpha+beta*true
# forms of precision profiles
gfun    <- function(true, gparms) {
  gvals = gparms[1]+gparms[2]*true^gparms[3]
  gvals
}
hfun    <- function(true, hparms) {
  hvals = hparms[1]+hparms[2]*true^hparms[3]
  hvals
}

# 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
pwd_known_fit <- PWD_known(X, Y, gfun, hfun,
                           gparms=c(4e-16, 0.07, 1.27),
                           hparms=c(6e-2, 7e-5, 2.2),
                           printem=TRUE)


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