# [R] replicating the odds ratio from a published study

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Jan 26 23:01:11 CET 2007

```Bob Green wrote:
> Peetr & Michael,
>
> I now see my description may have confused the issue.  I do want to compare
> odds ratios across studies - in the sense that I want to create a table
> with the respective odds ratio for each study. I do not need to
> statistically test two sets of odds ratios.
>
> What I want to do is ensure the method I use to compute an odds ratio is
> accurate and intended to check my method against published sources.
>
> The paper I selected by Schanda et al (2004). Homicide and major mental
> disorders. Acta Psychiatr Scand, 11:98-107 reports a total sample of 1087.
> Odds ratios are reported separately for men and women. There were 961 men
> all of whom were convicted of homicide. Of these 961 men, 41 were diagnosed
> with schizophrenia. The unadjusted odds ratio is for this  group of 41 is
> cited as 6.52   (4.70-9.00).  They also report the general population aged
> over 15 with schizophrenia =20,109 and the total population =2,957,239.
>
> Any further clarification is much appreciated,
>
>
A fisher.test on the following matrix seems about right:
> matrix(c(41,920,20109-41,2957239-20109-920),2)

[,1]    [,2]
[1,]   41   20068
[2,]  920 2936210

> fisher.test(matrix(c(41,920,20109-41,2957239-20109-920),2))

Fisher's Exact Test for Count Data

data:  matrix(c(41, 920, 20109 - 41, 2957239 - 20109 - 920), 2)
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
4.645663 8.918425
sample estimates:
odds ratio
6.520379

The c.i. is not precisely the same as your source. This could be down to
a different approximation (R's is based on the noncentral hypergeometric
distribution), but the classical asymptotic formula gives

> exp(log(41*2936210/920/20068)+qnorm(c(.025,.975))*sqrt(sum(1/M)))
[1] 4.767384 8.918216

which is closer, but still a bit narrower.

```