R Under development (unstable) (2024-06-25 r86831 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # > # Tests of integer case weights > # > library(deming) > > data1 <- ferritin[ferritin$period==2,] > data1$wt <- c(1:10, 10:1) > data2 <- data1[rep(1:20, c(1:10, 10:1)),] > > fit1a <- deming(new.lot ~ old.lot, data1, weight=wt) > fit1b <- deming(new.lot ~ old.lot, data2) > all.equal(coef(fit1a), coef(fit1b)) [1] TRUE > > fit2a <- deming(new.lot ~ old.lot, data1, cv=TRUE, weight=wt, conf=0) > fit2b <- deming(new.lot ~ old.lot, data2, cv=TRUE, conf=0) > all.equal(coef(fit2a), coef(fit2b)) [1] TRUE > > # Variable case wieghts do not replicate exactly for Thiel-Sen regression > # It is a problem of discreteness. > # However making all case weights the same gives a valid test > data3 <- data1[rep(1:20, 2),] > data1$wt2 <- rep(2,20) > for (sym in c(FALSE, TRUE)) { + fit3a <- theilsen(new.lot ~ old.lot, data1, weight=wt2, conf=0, + symmetric=sym) + fit3b <- theilsen(new.lot ~ old.lot, data3, conf=0, symmetric=sym) + print(all.equal(coef(fit3a), coef(fit3b))) + } [1] TRUE [1] TRUE > > for (m in 1:3) { + fit4a <- pbreg(new.lot ~ old.lot, data1, weight=wt2, conf=0, + method=m) + fit4b <- pbreg(new.lot ~ old.lot, data3, conf=0, method=m) + print(all.equal(coef(fit4a), coef(fit4b))) + } [1] TRUE [1] TRUE [1] TRUE > > > proc.time() user system elapsed 0.28 0.12 0.39