public static function oddsRatio(int $a, int $b, int $c, int $d) : array
{
// Odds ratio
$OR = $a / $b / ($c / $d);
// Standard error of the log odds ratio
$ln⟮OR⟯ = log($OR);
$SS{ln⟮OR⟯} = sqrt(1 / $a + 1 / $b + 1 / $c + 1 / $d);
// Confidence interval
$ci_lower_bound = exp($ln⟮OR⟯ - self::Z * $SS{ln⟮OR⟯});
$ci_upper_bound = exp($ln⟮OR⟯ + self::Z * $SS{ln⟮OR⟯});
// P-value (significance level)
$est = log($OR);
// estimate of effect
$l = log($ci_lower_bound);
// ln CI lower bound
$u = log($ci_upper_bound);
// ln CI upper bound
$SE = ($u - $l) / (2 * self::Z);
// standard error
$z = abs($est / $SE);
// test statistic z
$p = exp(self::NORMAL_LOWER_TAIL_PROBABILITY * $z - self::NORMAL_UPPER_TAIL_PROBABILITY * $z ** 2);
return ['OR' => $OR, 'ci_lower_bound' => $ci_lower_bound, 'ci_upper_bound' => $ci_upper_bound, 'p' => $p];
}