[R] mimic SPSS contingency table results

Petr PIKAL petr.pikal at precheza.cz
Thu Jul 8 10:59:04 CEST 2010


Dear all

Seems that puzzles always come in packs. I was asked to help with some 
statistics in blood analysis. (You can not refuse your wife's asks :-).

She has contingency table for values IgVH mutation and ZAP expression. I 
can do chi-square test (in R) and get a results, and with some literature 
I can try explain them. However she found an article in which they use 
SPSS and use gamma-squared test?? Resulting p-value is different from R 
chi square and seems to be close to fisher.test. 

They also get percentages for sensitivity and specificity with 95% 
confidence interval for these percentages and here I am lost. Also 
something called positive or negative predictive value is something I do 
not know how to get from contingency table.

Is it possible to get this in R? Where to look?

Here are data
mat <- matrix(c(22,7,9,15), 2,2)

>From that matrix they get:

positive statistical association between columns (IgVH mutation status) 
and rows (ZAP expression) with p=0.005
which is close to fisher.test

They also get sensitivity and specificity for prediction 62.5% (CI: 41-84) 
and 76% (CI: 59-93) respectively and positive predictive value 68% (CI: 
46-90) and negative predictive value 71% (CI: 53-89)

It seems that dividing observed value by marginal value is close but 
***how I can get confidence intervals***?
22/31 resp. 15/22 or 22/29 resp. 15/24

Any hint or explanation would be greatly appreciated.

Best regards
Petr

chisq.test(mat)

        Pearson's Chi-squared test with Yates' continuity correction

data:  mat 
X-squared = 6.4582, df = 1, p-value = 0.01104

fisher.test(mat)

        Fisher's Exact Test for Count Data

data:  mat 
p-value = 0.006152
alternative hypothesis: true odds ratio is not equal to 1 
95 percent confidence interval:
  1.391323 20.407944 
sample estimates:
odds ratio 
  5.057521



More information about the R-help mailing list