| Title: | Precision Profile Weighted Deming Regression |
|---|---|
| Description: | Weighted Deming regression, also known as 'errors-in-variable' regression, is applied with suitable weights. Weights are modeled via a precision profile; thus the methods implemented here are referred to as precision profile weighted Deming (PWD) regression. The package covers two settings – one where the precision profiles are known either from external studies or from adequate replication of the X and Y readings, and one in which there is a plausible functional form for the precision profiles but the exact (unknown) function must be estimated from the (generally singlicate) readings. The function set includes tools for: estimated standard errors (via jackknifing); standardized-residual analysis function with regression diagnostic tools for normality, linearity and constant variance; and an outlier analysis identifying significant outliers for closer investigation. Weighted Deming regression is also now implemented for multiple instruments. The following reference provides further information on mathematical derivations and applications. Hawkins, D.M., and J.J. Kraker (2026). 'Precision Profile Weighted Deming Regression for Methods Comparison'. The Journal of Applied Laboratory Medicine 11, 379-392 <doi:10.1093/jalm/jfaf183>. |
| Authors: | Douglas M. Hawkins [aut, cph], Jessica J. Kraker [aut, cre] |
| Maintainer: | Jessica J. Kraker <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.1.0.1 |
| Built: | 2026-06-03 11:23:03 UTC |
| Source: | https://github.com/jjkraker/ppwdeming |
This code estimates the variance profiles, assumed proportional, of the Rocke-Lorenzato form; also provides the resulting weighted Deming fit and residuals.
PWD_get_gh(X, Y, lambda = 1, rho=NA, alpha=NA, beta=NA, mu=NA, epsilon = 1e-8, printem=FALSE)PWD_get_gh(X, Y, lambda = 1, rho=NA, alpha=NA, beta=NA, mu=NA, epsilon = 1e-8, printem=FALSE)
X |
the vector of predicate readings. |
Y |
the vector of test readings. |
lambda |
optional (default of 1) - the ratio of the |
rho |
optional (default of NA) - numeric, single value or vector, initial estimate(s) of |
alpha |
optional (default of NA) - numeric, single value, initial estimate of |
beta |
optional (default of NA) - numeric, single value, initial estimate of |
mu |
optional (default of NA) - numeric, vector of length of |
epsilon |
optional (default of 1.e-8) - convergence tolerance limit. |
printem |
optional (default of FALSE) - if TRUE, routine will print out results as a |
This workhorse routine optimizes the likelihood in the unknown g, h
setting over its n+4 parameters
(the two Rocke-Lorenzato precision profile parameters
and , the intercept and slope ,
and the n latent true concentrations ).
That is, the assumed forms are:
predicate precision profile model: and
test precision profile model: .
The search algorithm implements an efficient approach via reparameterization
to the ratio .
If initial estimates are not provided, the parameters are initialized as:
alpha and beta are initially intercept and slope from simple linear regression;
rho is initialized as the vector c(0.01, 1, 100); and
mu is initialized as the values of X.
A list containing the following components:
alpha |
the fitted intercept |
beta |
the fitted slope |
fity |
the vector of predicted Y |
mu |
the vector of estimated latent true values |
resi |
the vector of residuals |
sigma |
the estimate of the Rocke-Lorenzato |
kappa |
the estimate of the Rocke-Lorenzato |
L |
the -2 log likelihood L |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Hawkins DM and Kraker JJ (2026). Precision Profile Weighted Deming Regression for Methods Comparison. The Journal of Applied Laboratory Medicine, 11(2), 379-392. https://doi.org/10.1093/jalm/jfaf183
Rocke DM, Lorenzato S (2012). A Two-Component Model for Measurement Error in Analytical Chemistry. Technometrics, 37:2:176-184.
# 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)) # fit with RL precision profile to estimate parameters RL_gh_fit <- PWD_get_gh(X,Y,printem=TRUE) # RL precision profile estimated parameters cat("\nsigmahat=", signif(RL_gh_fit$sigma,6), "and kappahat=", signif(RL_gh_fit$kappa,6), "\n") # with estimated linear coefficients cat("\nalphahat=", signif(RL_gh_fit$alpha,6), "and betahat=", signif(RL_gh_fit$beta,6), "\n")# 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)) # fit with RL precision profile to estimate parameters RL_gh_fit <- PWD_get_gh(X,Y,printem=TRUE) # RL precision profile estimated parameters cat("\nsigmahat=", signif(RL_gh_fit$sigma,6), "and kappahat=", signif(RL_gh_fit$kappa,6), "\n") # with estimated linear coefficients cat("\nalphahat=", signif(RL_gh_fit$alpha,6), "and betahat=", signif(RL_gh_fit$beta,6), "\n")
This routine fits the regression, uses the jackknife to get its precision, and optionally prints it out. Implements Rocke-Lorenzato as the variance profile model.
PWD_inference(X, Y, lambda=1, rho=NA, alpha=NA, beta=NA, mu=NA, MDL=NA, epsilon=1e-8, printem=FALSE)PWD_inference(X, Y, lambda=1, rho=NA, alpha=NA, beta=NA, mu=NA, MDL=NA, epsilon=1e-8, printem=FALSE)
X |
the vector of predicate readings. |
Y |
the vector of test readings. |
lambda |
optional (default of 1) - the ratio of the |
rho |
optional (default of NA) - numeric, single value or vector, initial estimate(s) of |
alpha |
optional (default of NA) - numeric, single value, initial estimate of |
beta |
optional (default of NA) - numeric, single value, initial estimate of |
mu |
optional (default of NA) - numeric, vector of length of |
MDL |
optional (default to missing) - medical decision level(s). |
epsilon |
optional (default of 1.e-8) - convergence tolerance limit. |
printem |
optional (default of FALSE) - if TRUE, routine will print out results as a |
For the linear model relating the predicate and test readings,
the standard errors of the estimators ,
, and their covariance are estimated by
the jackknife. The point estimates of the intercept and slope are output,
along with their standard errors and covariance.
These estimates are further used
to estimate the predictions at the input MDL.
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 |
preresi |
the vector of leave-one-out predicted residuals |
sigma |
the estimate of the Rocke-Lorenzato |
kappa |
the estimate of the Rocke-Lorenzato |
L |
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 |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Hawkins DM and Kraker JJ (2026). Precision Profile Weighted Deming Regression for Methods Comparison. The Journal of Applied Laboratory Medicine, 11(2), 379-392. https://doi.org/10.1093/jalm/jfaf183
Efron, B (1982). The jackknife, the bootstrap and other resampling plans. Society for Industrial and Applied Mathematics.
# 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)) # fit with RL precision profile to estimate parameters and variability RL_inf <- PWD_inference(X,Y,MDL=12,printem=TRUE)# 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)) # fit with RL precision profile to estimate parameters and variability RL_inf <- PWD_inference(X,Y,MDL=12,printem=TRUE)
This code is used for the setting of known precision profiles implemented
in user-provided R functions called gfun and hfun.
PWD_known(X, Y, gfun, hfun, gparms, hparms, epsilon=1e-8, MDL=NA, getCI=TRUE, printem=FALSE)PWD_known(X, Y, gfun, hfun, gparms, hparms, epsilon=1e-8, MDL=NA, getCI=TRUE, printem=FALSE)
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 |
hparms |
a numeric vector containing any parameters referenced by |
epsilon |
optional (default of 1.e-8) - convergence tolerance limit. |
MDL |
optional (default of NA) - medical decision level(s). |
getCI |
optional (default of TRUE) - allows for jackknifed standard errors on the regression and MDL. |
printem |
optional (default of FALSE) - if TRUE, routine will print out results as a |
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 and
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.
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 |
L |
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 |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
# 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), MDL=12, printem=TRUE)# 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), MDL=12, printem=TRUE)
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, rho=NA, alpha=NA, beta=NA, mu=NA)PWD_outlier(X, Y, K, lambda=1, Pcut=0.01, rho=NA, alpha=NA, beta=NA, mu=NA)
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 |
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 |
alpha |
optional (default of NA) - numeric, single value, initial estimate of |
beta |
optional (default of NA) - numeric, single value, initial estimate of |
mu |
optional (default of NA) - numeric, vector of length of |
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.
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 |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Hawkins DM and Kraker JJ (2026). Precision Profile Weighted Deming Regression for Methods Comparison. The Journal of Applied Laboratory Medicine, 11(2), 379-392. https://doi.org/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.
# 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)# 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)
This routine fits the Rocke-Lorenzato precision profile model to the residuals from the fit.
PWD_resi(true, resi, epsilon=1e-8, printem=FALSE)PWD_resi(true, resi, epsilon=1e-8, printem=FALSE)
true |
the vector of values used to predict the precision – commonly X. |
resi |
the vector of residuals whose variance is thought to be a function of “true”. |
epsilon |
optional (default of 1e-8) - convergence tolerance limit. |
printem |
optional (default of FALSE) - if TRUE, routine will print out results as a |
The Rocke-Lorenzato precision profile model is
for the residuals from a precision-profile model fit.
Under this model, the approach for reviewing residuals is to fit a
variance profile model to the residuals themselves. The output
of this function includes a maximum-likelihood estimate of the remaining
parameter in the special cases of:
constant variance ( = 0); and
constant coefficient of variation ( = 0).
A list containing the following components:
sigmar |
the estimate of |
kappar |
the estimate of |
L |
the -2 log likelihood |
scalr |
the scaled residuals |
poolsig |
the maximum likelihood estimate of |
poolkap |
the maximum likelihood estimate of |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Hawkins DM and Kraker JJ (2026). Precision Profile Weighted Deming Regression for Methods Comparison. The Journal of Applied Laboratory Medicine, 11(2), 379-392. https://doi.org/10.1093/jalm/jfaf183
Hawkins DM (2014). A Model for Assay Precision. Statistics in Biopharmaceutical Research, 6, 263-269. http://dx.doi.org/10.1080/19466315.2014.899511
# 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)) # fit the model and store output RL_gh_fit <- PWD_get_gh(X,Y) # run the residual analysis from the model output post <- PWD_resi(X, RL_gh_fit$resi, printem=TRUE)# 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)) # fit the model and store output RL_gh_fit <- PWD_get_gh(X,Y) # run the residual analysis from the model output post <- PWD_resi(X, RL_gh_fit$resi, printem=TRUE)
This code fits the weighted Deming regression on
predicate readings (X) and test readings (Y),
with user-supplied Rocke-Lorenzato ("RL") parameters
sigma () and kappa ().
PWD_RL(X, Y, sigma, kappa, lambda=1, alpha=NA, beta=NA, mu=NA, epsilon=1e-8)PWD_RL(X, Y, sigma, kappa, lambda=1, alpha=NA, beta=NA, mu=NA, epsilon=1e-8)
X |
the vector of predicate readings. |
Y |
the vector of test readings. |
sigma |
the RL |
kappa |
the RL |
lambda |
optional (default of 1) - the ratio of the |
alpha |
optional (default of NA) - numeric, single value, initial estimate of |
beta |
optional (default of NA) - numeric, single value, initial estimate of |
mu |
optional (default of NA) - numeric, vector of length of |
epsilon |
optional (default of 1e-8) - convergence tolerance limit. |
The Rocke-Lorenzato precision profile model assumes the following
forms for the variances, with proportionality constant :
predicate precision profile model: and
test precision profile model: .
The algorithm uses maximum likelihood estimation. Proportionality constant
is assumed to be known or estimated externally.
A list containing the following components:
alpha |
the fitted intercept |
beta |
the fitted slope |
fity |
the vector of predicted Y |
mu |
the vector of estimated latent true values |
resi |
the vector of residuals |
L |
the -2 log likelihood L |
innr |
the number of inner refinement loops executed |
error |
an error code if the iteration fails |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Hawkins DM and Kraker JJ (2026). Precision Profile Weighted Deming Regression for Methods Comparison. The Journal of Applied Laboratory Medicine, 11(2), 379-392. https://doi.org/10.1093/jalm/jfaf183
Hawkins DM (2014). A Model for Assay Precision. Statistics in Biopharmaceutical Research, 6, 263-269. https://doi.org/10.1080/19466315.2014.899511
# 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)) # fit RL with given sigma and kappa RL_results <- PWD_RL(X,Y,sigma,kappa) cat("\nWith given sigma and kappa, the estimated intercept is", signif(RL_results$alpha,4), "and the estimated slope is", signif(RL_results$beta,4), "\n")# 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)) # fit RL with given sigma and kappa RL_results <- PWD_RL(X,Y,sigma,kappa) cat("\nWith given sigma and kappa, the estimated intercept is", signif(RL_results$alpha,4), "and the estimated slope is", signif(RL_results$beta,4), "\n")
This code fits the weighted Deming regression on predicate readings (X) and test readings (Y).
WD_General(X, Y, g, h, epsilon=1e-8)WD_General(X, Y, g, h, epsilon=1e-8)
X |
the vector of predicate readings. |
Y |
the vector of test readings. |
g |
the vector of variances of the |
h |
the vector of variances of the |
epsilon |
optional (default of 1e-8) - convergence tolerance limit. |
This function is used when the variances of X and Y are already known,
as can be the case from an adequate number of replicate X and Y readings
of each sample. For input vectors g and h containing the variances of
predicate readings X and test readings Y, respectively, iteratively fits
weighted Deming regression.
A list containing the following components:
alpha |
the fitted intercept |
beta |
the fitted slope |
cor |
the Pearson correlation between |
fity |
the vector of predicted Y |
mu |
the vector of estimated latent true values |
resi |
the vector of residuals |
L |
the -2 log likelihood L |
innr |
the number of inner refinement loops executed |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Ripley BD and Thompson M (1987). Regression techniques for the detection of analytical bias. Analyst, 112, 377-383.
# 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")# 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")
This routine, provided for convenience, makes Linnet’s constant CV fit.
WD_Linnet(X, Y, lambda=1, MDL=NA, getCI=TRUE, epsilon=1e-10, printem=FALSE)WD_Linnet(X, Y, lambda=1, MDL=NA, getCI=TRUE, epsilon=1e-10, printem=FALSE)
X |
the vector of predicate readings. |
Y |
the vector of test readings. |
lambda |
ratio of g function to h function. |
MDL |
optional (default of NA) - medical decision limit(s). |
getCI |
optional (default of TRUE) - if TRUE, generates jackknife standard errors. |
epsilon |
optional (default of 1e-10) - tolerance limit. |
printem |
optional (default of FALSE) - if TRUE, prints out results as a |
Note that in cases where sigma happens to come out zero, Linnet’s constant CV fit differs from the precision-profile fit since the underlying precision profile models are not the same.
A list containing the following components:
alpha |
the fitted intercept |
beta |
the fitted slope |
cor |
the Pearson correlation between X and Y |
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 |
Douglas M. Hawkins, Jessica J. Kraker [email protected]
Linnet K (1993). Evaluation of regression procedures for methods comparison studies. Clinical Chemistry, 39: 424-432.
# library library(ppwdeming) # parameter specifications alpha <- 1 beta <- 1.1 true <- 8*10^((0:99)/99) truey <- alpha+beta*true kappa <- 0.1 # simulate single sample - set seed for reproducibility set.seed(1039) # specifications for predicate method X <- true *(1+kappa*rnorm(100)) # specifications for test method Y <- truey *(1+kappa*rnorm(100)) # fit with to estimate linear parameters wd_fit <- WD_Linnet(X, Y, MDL=12, printem=TRUE) cat("\nThe Linnet constant-CV estimated intercept is", signif(wd_fit$alpha,4), "and the estimated slope is", signif(wd_fit$beta,4), "\n")# library library(ppwdeming) # parameter specifications alpha <- 1 beta <- 1.1 true <- 8*10^((0:99)/99) truey <- alpha+beta*true kappa <- 0.1 # simulate single sample - set seed for reproducibility set.seed(1039) # specifications for predicate method X <- true *(1+kappa*rnorm(100)) # specifications for test method Y <- truey *(1+kappa*rnorm(100)) # fit with to estimate linear parameters wd_fit <- WD_Linnet(X, Y, MDL=12, printem=TRUE) cat("\nThe Linnet constant-CV estimated intercept is", signif(wd_fit$alpha,4), "and the estimated slope is", signif(wd_fit$beta,4), "\n")