View source: R/lower_level_disprop_analysis.R
ic | R Documentation |
Calculates the information component ("IC") and credibility interval, used in disproportionality analysis.
ic(obs = NULL, exp = NULL, shrinkage = 0.5, conf_lvl = 0.95)
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). |
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)]
A tibble with three columns (point estimate and credibility bounds).
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.
Nor_n_2011pvda
ic(obs = 20, exp = 10)
# Note that obs and exp can be vectors (of equal length, no recycling allowed)
ic(obs = c(20, 30), exp = c(10, 10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.