Dear R epidemiologists,

I have been trying to find the simplest possible way to:

(a) Create contingency tables,
(b) Perform a chi square or fisher exact test on those contingency tables,
and
(c) Determine sensitivity, specificity and predictive values etc from a
rapid test compared to gold standard.

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)

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





-- 
Amy Mikhail
Program Manager, ACTc Afghanistan Malaria Project
London School of Hygiene & Tropical Medicine

****** NEW HPRO OFFICE ADDRESS
************************************************************************************************************************
HPRO Head Office, House number P860 (10th house on the right off Taimany
road), Street 10, Taimany, District 10, Kabul, Afghanistan
*********************************************************************************************************************************************************************

Email (Afg): amy.mikhail@googlemail.com
Email (UK): Amy.Mikhail@lshtm.ac.uk
Tel (Afg): +93 (0)706 126627
Tel (UK): +44 (0)781 4176107

	[[alternative HTML version deleted]]

