# undefined odds ration

##### New Member
Hi everybody,
i have a problem in calculation of odds ratio if one cells was zero. has any one any idea about how to calculate it?

##### New Member
thank you very much for your help
well i read that there are two types of solution
"Two solutions are proposed for the estimation of odds ratios (OR) when one or the two elements of the principal (A, D) or secondary (B, C) diagonals of a 2 x 2 matrix (A, B, C, D) are 0. The OR estimate is AD/BC. If A or D are 0, OR = 0; if B or C are 0, the OR is undefined. Analytical solution. This solution conserves the marginal totals. If B = 0 and C = 0, the OR cannot be less than AD/1 (the minimal acceptable value), then the equation (A-X) (D-X)/X2 = KAD/1 searches for that X which subtracted to A and B and added to B (0) and C (0) yields an OR K times AD; if B = 0 and C > 0 then (A-X) (D-X)/X (C+X) = AD/C; if B > 0 and C = 0, then B replaces C in the latter equation. If A and D are 0, X2/(B-X) (C-X) = 1/KBC; if A = 0 and D > 0, X (D+X)/(B-X) (C-X) = D/KBC; if A > 0 and D = 0, A replaces D in the latter equation. K can be taken at the maximum Chi squared value. Probabilistic solution. Zeros are replaced by ones and the elements of the diagonal without zeros are increased proportionally until the exact probability (Fisher) of this new matrix is equal or the nearest less than the exact probability of the original matrix. Since small numbers increase the estimation bias, the Haldane's correction should be always applied. This correction adds 0.5 to A, B C and D to estimate the OR (In OR) and adds 1 to these elements to estimate their variance."
i think your reply coming with the last solution, i want to ask if the variance mean the CI. Can you explain Haldane's correction to me?

#### mp83

##### TS Contributor
Well, to be honest I don't really know why add 1 when computing the variance but I looked up in Agresti's book that the adjustment for .5 works for the s.e of the log(OR) and you can get a CI,

log(OR)-z(a/2)*sqrt(sum(1/nij)) , log(OR)+z(a/2)*sqrt(sum(1/nij))​

Hope it helps!

##### New Member
thank you very much. If you don't mind, may you write to the me the refrence you get this solutoin from? i want to inlcude it in my thesis.
Thankyou

#### mp83

##### TS Contributor
I think any book on Categorical Data will mention it.

I use

A. Agresti - Categorical Data Analysis (2002)​

You can find it in p. 70-71. You will find other ways to handle this too.