GithubHelp home page GithubHelp logo

chstock / dtcompair Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 3.67 MB

Comparison of Binary Diagnostic Tests in a Paired Study Design

Home Page: https://chstock.github.io/DTComPair/

R 100.00%
clinical-epidemiology comparative-analysis cran diagnosis diagnostic-accuracy-studies medicine r r-package sensitivity specificity

dtcompair's People

Contributors

anddis avatar chstock avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

anddis

dtcompair's Issues

Corner case (?): tab.paired only diseased (or nondiseased)

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

Two feature requests

Hello Christian,

Thank you for this very useful package!

If you don't mind, I'd have two feature requests for you to consider:

  1. 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)

  2. Calculate and return the estimated covariance $\hat\sigma_{PN}$ [2] (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.

Harmonise referent test across functions?

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/Test2
  • pv.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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.