virgil/commit
FIX chi calculation
author | Michiel Hildebrand |
---|---|
Tue Jul 16 00:21:09 2013 +0200 | |
committer | Michiel Hildebrand |
Tue Jul 16 00:21:09 2013 +0200 | |
commit | 0222a5a931e117245b2b1eed1d81eead4b4928fd |
tree | 7ecb4309e67f0cdd67273cd51ee54ea8677b3c04 |
parent | af94181e702242940bfcb155e5d286afc51b6831 |
Diff style: patch stat
diff --git a/api/reports.pl b/api/reports.pl index 505677e..55aa6db 100644 --- a/api/reports.pl +++ b/api/reports.pl @@ -215,7 +215,7 @@ http_chi(Request) :- ), contingency_table(Drug, DrugMatch, Reaction, A,B,C,D,AB,AC,BD,CD,ABCD), - Chi is (A/C)/(AB/ABCD), + Chi is ((A*D-B*C)^2*(A+B+C+D))/(AB*CD*BD*AC), reply_json(json([chi=Chi, formula='(ad-bc)^2(a+b+c+d)/((a+b)*(c+d)*(b+d)*(a+c))', a=A,