An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-epi/attachments/20100202/8cd5f710/attachment.pl>
Incorrect instructions for epibasix sensSpec?
4 messages · Peter Dalgaard, Amy Mikhail
Amy Mikhail wrote:
Dear R epidemiologists,
The package help for the above function states:
Arguments X A 2x2 matrix, with Gold Standard Class A and B in the columns
and Comparison Method A and B in the rows.
I understood this to mean the following:
Gold standard
Comparison method A (neg) B (pos)
A (neg) 18 1
B (pos) 0 201
However, it gives the results backwards:
sensSpec(t1)
Simple Sensitivity and Specitivity Output
Input Matrix:
ref
r1a negative positive
negative 18 1
positive 0 201
The sample of sensitivity is: 100%
The sample of specificity is: 99.5%
but if you calculate the sensitivity and specificity by hand, sensitivity is
99.5 and specificity is 100%....
That depends on the definition of negative and positive. The documentation is certainly unclear, but it seems likely that the intention is for the table to have positives in the first row and column. Have you consulted the reference given? (Notably, the example table.)
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-epi/attachments/20100202/de5de9a7/attachment.pl>
Amy Mikhail wrote:
Dear Peter, Many thanks for your reply. Unfortunately I don't have access to the reference book. However it looks to me like the gold standard should be in the rows and the comparison method should be in the columns for the test to give the right answer (since the location of the gold standard determines which are true and false positives, etc, which determines what the denominators of the formulae are). I tried swapping around the negatives and positives, but that doesn't make much difference to the result (it is still the wrong way around):
> t1
positive negative positive 201 1 negative 0 18
> sensSpec(t1)
Simple Sensitivity and Specitivity Output
Input Matrix:
positive negative
positive 201 1
negative 0 18
The sample of sensitivity is: 100%
The sample of specificity is: 94.7%
Umm, maybe I'm not quite awake yet, but if you're switching positive and negatives, the 1 should end up in the other corner so that the gold standard has 202 positives and 18 negatives, with 1 false positive and no false negatives. I.e., the sensitivity ia 201/202 and specificity is 18/18. Transposing the tables would give you predictive probabilities, which are different beasts entirely. ....
sensSpec(t1)
Simple Sensitivity and Specitivity Output
Input Matrix:
ref
r1a negative positive
negative 18 1
positive 0 201
The sample of sensitivity is: 100%
The sample of specificity is: 99.5%
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907