chstock / dtcompair Goto Github PK
View Code? Open in Web Editor NEWComparison of Binary Diagnostic Tests in a Paired Study Design
Home Page: https://chstock.github.io/DTComPair/
Comparison of Binary Diagnostic Tests in a Paired Study Design
Home Page: https://chstock.github.io/DTComPair/
Hello Christian,
I have been using DTComPair a lot to analyse real data from two paired studies. It's been extremely helpful!
I have stumbled upon what could be considered a corner-case: if all subjects are diseased (d=1
) or non-diseased (d=0
), tab.paired
stops with an error:
Error in eval(substitute(d), data, parent.frame()) :
numeric 'envir' arg not of length one
What do you think about changing the check
if (identical(sort(unique(d)), as.integer(c(0, 1))) == FALSE)
with something like
if (all(unique(d) %in% c(0, 1)) == FALSE)
?
(In a similar fashion, one could consider modifying the checks for y1
and y2
).
I am a bit hesitant because this would cause errors downstream (eg, in sesp.rel
, but not in tpffpf.rel
), and making the necessary changes to all functions would be a lot of work. At the same time, for example in the example below, calculating the rTPF would be ok...
> df <- data.frame(
+ d = rep(1, 10),
+ y1 = rbinom(10, 1, 0.3),
+ y2 = rbinom(10, 1, 0.7)
+ )
> paired.data <- tab.paired2(d, y1, y2, df)
> paired.data
Two binary diagnostic tests (paired design)
Test1: 'y1'
Test2: 'y2'
Diseased:
Test1 pos. Test1 neg. Total
Test2 pos. 2 6 8
Test2 neg. 0 2 2
Total 2 8 10
Non-diseased:
Test1 pos. Test1 neg. Total
Test2 pos. 0 0 0
Test2 neg. 0 0 0
Total 0 0 0
> tpffpf.rel(paired.data)
$tpf
rel.tpf se.log.rel.tpf lcl.rel.tpf ucl.rel.tpf pval.rel.tpf
4.00000000 0.61237244 1.20450229 13.28349491 0.02358585
$fpf
rel.fpf se.log.rel.fpf lcl.rel.fpf ucl.rel.fpf pval.rel.fpf
NaN NaN NaN NaN NaN
$alpha
[1] 0.05
(tab.paired2
is a modified version of tab.paired
where I made the suggested change above to the if
condition).
What do you think?
Thank you for taking the time to consider this.
Andrea
See: Yougui Wu (2023). Simple methods for comparing two predictive values with incomplete data. Journal of Biopharmaceutical Statistics, DOI: 10.1080/10543406.2023.2188925.
Hello Christian,
Thank you for this very useful package!
If you don't mind, I'd have two feature requests for you to consider:
Add a function to compare TPF and TNF on a relative scale [1] (and/or FPF, since relative FPF is estimable also from screen-positive paired data, unlike relative TNF)
Calculate and return the estimated covariance pv.rpv()
function)
Thank you for considering these requests,
Andrea
[1] Cheng, H. and Macaluso, M., 1997. Comparison of the accuracy of two tests with a confirmatory procedure limited to positive results. Epidemiology, pp.104-106.
[2] Moskowitz, C.S. and Pepe, M.S., 2006. Comparing the predictive values of diagnostic tests: sample size and analysis for paired study designs. Clinical trials, 3(3), pp.272-279.
Hello Christian,
Sorry for bothering you with another issue. I have been using DTComPair
for some actual data analysis and I have noticed that:
sesp.rel
and tpffpf.rel
both compute Test2/Test1: I coded them so to be consistent with sesp.diff.ci
, sesp.mcnemar
, and sesp.exactbinom
's behaviour (ie, Test2-Test1)pv.rpv
computes Test1/Test2pv.gs
and pv.wgs
compute abs(Test1-Test2) (as per R code), but the help file says Test2-Test1. Is there a reason for taking the absolute value?I believe it would be good to harmonise the test used as referent across the package's functions. Let me know what you think.
(PS: one could consider also harmonising what is returned by the package's functions: either always a list of named vectors, like sesp.diff.ci
, or a list of lists, like sesp.mcnemar
.)
Thank you for considering this!
Implement 2 d.f. chi-square test by Lachenbruch and Lynch (Stat Med, 1998, 17: 2207-17), as a 'generalized' McNemar's test, for a joint comparison of sensitivity and specificity.
See: Yougui Wu (2023). Joint comparison of the predictive values of multiple binary diagnostic tests: an extension of McNemar’s test, Journal of Biopharmaceutical Statistics, 33:1, 31-42. DOI: 10.1080/10543406.2022.2065500.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.