[R] mimic SPSS contingency table results

Petr PIKAL petr.pikal at precheza.cz
Thu Jul 8 11:55:02 CEST 2010


Thanks, 

now I have to think it over how to explain it to statistics analphabet and 
to transfer to measured data. Is there any "simple theory for dummies" 
book to look into?

Best regards
Petr



r-help-bounces at r-project.org napsal dne 08.07.2010 11:33:45:

> Dear Petr,
> the ppv / npv are the conditional probabilities beeing ill/not ill
> having a positive/negative test result.
> So the ppv is the proportion of correct positive tests of all positive
> tests and respectively the npv the proportion of true negative tests of
> all negative tests.
> Alternatively, you can use Bayes theorem
> PPV = P(D+|T+) = sensitivity*prevalence/(sensitivity*prevalence +
> (1-specificity)*(1-prevalence))
> D+ disease, T+ stands for "positive Test".
> 
> With this, you can either use a normal approximation for a CI: 
> ppv+-1.96*sqrt( ppv*(1-ppv)/(# pos. tests)) or exact binomial confidence
> limits,
> 
> binom.test(number of true positive,number positive Tests)
> 
> This works for all other proportions as well, eg sensitivity=P(T+|D+) :
> 
> p<-15/24   #sensitivity
> p+qnorm(.975)*c(-1,1)*sqrt(p*(1-p)/24)
> binom.test(15,24)
> 
> hth.
> 
> Am 08.07.2010 10:59, schrieb Petr PIKAL:
> > 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
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> > 
> 
> -- 
> Eik Vettorazzi
> Institut für Medizinische Biometrie und Epidemiologie
> Universitätsklinikum Hamburg-Eppendorf
> 
> Martinistr. 52
> 20246 Hamburg
> 
> T ++49/40/7410-58243
> F ++49/40/7410-57790
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list