Test on device-events using the Likelihood Ratio Test, originally proposed by Huang & Tiwari (2011). From the family of disproportionality analyses (DPA) used to generate signals of disproportionate reporting (SDRs).
lrt(df, ...)# S3 method for mds_ts
lrt(df, ts_event = c(Count = "nA"), analysis_of = NA, ...)
# S3 method for default
lrt(
df,
analysis_of = NA,
eval_period = 1,
alpha = 0.05,
mc_sample = 10000,
...
)
Required input data frame of class mds_ts
or, for generic
usage, any data frame with the following columns:
Unique times of class Date
Cell A count (class numeric
) of the 2x2 table:
device/event of interest.
Cell B count (class numeric
) of the 2x2 table:
device/non-event of interest.
Cell C count (class numeric
) of the 2x2 table:
non-device/event of interest.
Cell D count (class numeric
) of the 2x2 table:
non-device/non-event of interest.
Further arguments passed onto lrt
methods
Required if df
is of class mds_ts
. Named string
indicating the variable corresponding to the event count (cell A in the 2x2
contingency table). In most cases, the default is the appropriate setting.
See details for alternative options.
Default: c("Count"="nA")
corresponding to the event count column in
mds_ts
objects. Name is generated from mds_ts
metadata.
Optional string indicating the English description of what
was analyzed. If specified, this will override the name of the
ts_event
string parameter.
Default: NA
indicates no English description for plain df
data frames, or ts_event
English description for df
data frames
of class mds_ts
.
Example: "Count of bone cement leakages"
Required positive integer indicating the number of unique times counting in reverse chronological order to sum over to create the 2x2 contingency table.
Default: 1
considers only the most recent time in df
.
Example: 12
sums over the last 12 time periods to create the 2x2
contingency table.
Alpha or Type-I error rate in the range (0, 1), used to determine signal status. It is the threshold for determining if the observed reporting rate is greater than the expected based on Monte Carlo simulations of the null.
Default: 0.05
is an alpha level of 0.05 or 5%.
Number of Monte Carlo samples for constructing the null distribution based on empirical data. Lowest recommended is 1000. Increasing iterations also increases p-value precision.
Default: 10000
uses 10000 bootstrap iterations.
A named list of class mdsstat_test
object, as follows:
Name of the test run
English description of what was analyzed
Named boolean of whether the test was run. The name contains the run status.
A standardized list of test run results: statistic
for the test statistic, lcl
and ucl
for the set
confidence bounds, p
for the p-value, signal
status, and
signal_threshold
.
The test parameters
The data on which the test was run
mds_ts
: LRT on mds_ts data
default
: LRT on general data
This is an implementation of the "Regular LRT" per
Huang & Tiwari (2019). It assumes a test on a single event of interest
where all other events & devices are collapsed, effectively testing a 2x2
table only. Therefore this is a test on the significance of the likelihood
ratio instead of the maximum likelihood over i
events for a given
medical product j
(refer to Huang & Tiwari, 2011).
For parameter ts_event
, in the uncommon case where the
device-event count (Cell A) variable is not "nA"
, the name of the
variable may be specified here. Note that the remaining 3 cells of the 2x2
contingency table (Cells B, C, D) must be the variables "nB"
,
"nC"
, and "nD"
respectively in df
. A named character
vector may be used where the name is the English description of what was
analyzed. Note that if the parameter analysis_of
is specified, it will
override this name. Example: ts_event=c("Count of Bone Cement
Leakages"="event_count")
Huang L, Zalkikar J, Tiwari RC. A Likelihood Ratio Test Based Method for Signal Detection with Application to FDA<U+2019>s Drug Safety Data. Journal of the American Statistical Association, 2011, Volume 106, Issue 496, 1230-1241.
Huang L, Zalkikar J, Tiwari RC. Likelihood-Ratio-Test Methods for Drug Safety Signal Detection from Multiple Clinical Datasets. Comput Math Methods Med. 2019, PMC6399568.
# NOT RUN {
# Basic Example
data <- data.frame(time=c(1:25),
nA=as.integer(stats::rnorm(25, 25, 5)),
nB=as.integer(stats::rnorm(25, 50, 5)),
nC=as.integer(stats::rnorm(25, 100, 25)),
nD=as.integer(stats::rnorm(25, 200, 25)))
a1 <- lrt(data)
# Example using an mds_ts object
a2 <- lrt(mds_ts[[3]])
# }
Run the code above in your browser using DataLab