Calculates the information component ("IC") and credibility interval, used in disproportionality analysis.
Arguments
- obs
A numeric vector with observed counts, i.e. number of reports for the selected drug-event-combination. Note that shrinkage (e.g. +0.5) is added inside the function and should not be included here.
- exp
A numeric vector with expected counts, i.e. number of reports to be expected given a comparator or background. Note that shrinkage (e.g. +0.5) is added inside the function and should not be included here.
- shrinkage
A non-negative numeric value, to be added to observed and expected count. Default is 0.5.
- conf_lvl
Confidence level of confidence or credibility intervals. Default is 0.95 (i.e. 95 % confidence interval).
Details
The IC is a log2-transformed observed-to-expected ratio, based on the relative reporting rate (RRR) for counts, but modified with an addition of "shrinkage" to protect against spurious associations.
$$\hat{IC} = log_{2}(\frac{\hat{O}+k}{\hat{E}+k})$$
where \(\hat{O}\) = observed number of reports, \(k\) is the shrinkage (typically +0.5), and expected \(\hat{E}\) is (for RRR, and using the entire database as comparator or background) estimated as
$$ \hat{E} = \frac{\hat{N}_{drug} \times \hat{N}_{event}}{\hat{N}_{TOT}}$$
where \(\hat{N}_{drug}\), \(\hat{N}_{event}\) and \(\hat{N}_{TOT}\) are the number of reports with the drug, the event, and in the whole database respectively.
The credibility interval is created from the quantiles of the posterior gamma distribution with shape (\(\hat{S}\)) and rate (\(\hat{R}\)) parameters as
$$\hat{S} = \hat{O} + k$$ $$\hat{R} = \hat{E} + k$$
using the stats::qgamma
function. Parameter \(k\) is the shrinkage defined
earlier. For completeness, a credibility interval of the gamma distributed \(X\) (i.e.
\(X \sim \Gamma(\hat{S}, \hat{R})\) where \(\hat{S}\) and \(\hat{R}\) are shape and rate parameters)
with associated quantile function \(Q_X(p)\) for a significance level \(\alpha\) is
constructed as
$$[Q_X(\alpha/2), Q_X(1-\alpha/2)]$$
Further details
From a bayesian point-of-view, the credibility interval of the IC is constructed from the poisson-gamma conjugacy. The shrinkage constitutes a prior of observed and expected of 0.5. A shrinkage of +0.5 with a gamma-quantile based 95 % credibility interval cannot have lower bound above 0 unless the observed count exceeds 3. One benefit of \(log_{2}\) is to provide a log-scale for convenient plotting of multiple IC values side-by-side.
References
Norén GN, Hopstadius J, Bate A (2011). “Shrinkage observed-to-expected ratios for robust and transparent large-scale pattern discovery.” Statistical Methods in Medical Research, 22(1), 57--69. doi:10.1177/0962280211403604 , https://doi.org/10.1177/0962280211403604.
Examples
ic(obs = 20, exp = 10)
#> # A tibble: 1 × 3
#> ic2.5 ic ic97.5
#> <dbl> <dbl> <dbl>
#> 1 0.264 0.965 1.53
# Note that obs and exp can be vectors (of equal length, no recycling allowed)
ic(obs = c(20, 30), exp = c(10, 10))
#> # A tibble: 2 × 3
#> ic2.5 ic ic97.5
#> <dbl> <dbl> <dbl>
#> 1 0.264 0.965 1.53
#> 2 0.976 1.54 2.01