[R-sig-Epi] Problem with DiagnosisMed package
David Winsemius
dwinsemius at comcast.net
Mon Feb 1 22:33:51 CET 2010
On Feb 1, 2010, at 4:10 PM, Amy Mikhail wrote:
> Dear R epidemiologists,
>
> I have been trying to find the simplest possible way to:
>
> (a) Create contingency tables,
?xtabs
> (b) Perform a chi square or fisher exact test on those contingency
> tables,
> and
?chisq.test
?fisher.test
> (c) Determine sensitivity, specificity and predictive values etc
> from a
> rapid test compared to gold standard.
Those concepts are more typically used with a continuous test result
such as hemoglobin or ALT that is predicting a "diagnosis". The ROC
plotting facilities in the Epi package are quite good if that were the
data situation.
>
> More on my contingency table problem later, but for now problem (c):
>
> I tried to use the DiagnosisMed package, since by the description it
> seemed
> I could use my two variables (gold standard test results and results
> of test
> being evaluated) directly with the function (i.e. no need to make a
> 2x2
> table first since the function would do this as well).
>
> I carefully coded my gold standard and test results as "positive" and
> "negative", and removed all NAs. I converted both columns from
> character to
> factors (which now had 2 levels).
>
> Then I tried this:
>
> diagnosis(ref, r1a)
No experience with that package.
>
> where ref is my gold standard and r1a is my test being evaluated.
>
> I got this error:
>
> Error in uniroot(function(or) { :
> f() values at end points not of opposite sign
>
> I can't understand why - the data is as clean as a whistle. Here is
> the
> summary, fyi (six tests are being evaluated against one gold
> standard):
>
> summary(analc)
> ref r1a r1b r2a
> r2b r3a r3b
> negative: 18 negative: 19 negative: 19 negative: 36
> negative: 33
> negative: 23 negative: 22
> positive:202 positive:201 positive:201 positive:184 positive:
> 187
> positive:197 positive:198
>
> Did I misunderstand? Does the diagnosis function require a 2x2
> table as
> input?
>
> Many thanks,
> Amy
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-sig-Epi
mailing list