simulateSRS: Simulating a Spontaneous Reporting System

Description Usage Arguments Value See Also

View source: R/simulateSRS.R

Description

simulateSRS simulates a spontaneous reporting (SR) data set. The relationships between the drugs and the adverse events (AEs) are specified by a directed acyclic graph (DAG), see generateDAG.

Each report to a SRS contains two lists:

  1. the drugs to which the patient was (thought to be) exposed to, and

  2. the AEs that the patient experienced.

We will represent each report as a binary vector. The first items represent whether the patient was exposed to the drug (1 if he/she was, and 0 otherwise). The second part represents whether the patient experienced the event or not (1 if he/she did, and 0 otherwise). For example, if there are 3 drugs and 4 events in total, a typical report could be

0 1 0 1 1 0 0

which represents that the patient was exposed to drug 2 (but not to drug 1 and 3), and experienced event 1 and 2 (but not 3 and 4). The simulation results in a binary matrix where each row is a report.

Valid Reports Not any binary sequence is a valid report. Each report should contain at least one drug and at least one event (otherwise it would never been sent to the spontaneous reporitng sytem). While generating reports, we make sure that this is indeed the case. When one does not want to check the validity and wants to allow any binary sequence, one can set valid_reports to FALSE.

Usage

1
2
3
4
simulateSRS(n_reports = 100, n_drugs = 10, n_events = 10,
  alpha_drugs = 1, beta_drugs = 20, alpha_events = 1, beta_events = 20,
  n_innocent_bystanders = 5, bystander_prob = 0.9, n_correlated_pairs = 2,
  theta = 2, valid_reports = TRUE, seed = NULL, verbose = TRUE)

Arguments

n_reports

Number of reports (Default: 100)

n_drugs

Number of drugs (Default: 10)

n_events

Number of adverse drug events (Default: 10)

alpha_drugs

Alpha parameter for the drug marginal probabilities (Default: 1.0)

beta_drugs

Beta parameter for the drug marginal probabilities (Default: 20.0)

alpha_events

Alpha parameter for the event marginal probabilities (Default: 1.0)

beta_events

Beta parameter for the event marginal probabilities (Default: 20.0)

n_innocent_bystanders

Number of innocent bystanders (Default: 5)

bystander_prob

The conditional probability of the innocent bystander being one when the drug that is actually causing the AE is equal to 1. This parameter corresponds to γ in the paper (Default: .9)

n_correlated_pairs

Number of drug-AE pairs that are associated (Default: 2)

theta

Increase in odds-ratio when there is an edge going from a drug to an AE (Default: 2.0). In case theta is a vector of length two, the odds ratio is drawn from a truncated Normal distribution with mean theta[1] and variance theta[2]

valid_reports

If TRUE, only valid reports (with at least one drug and at least one AE) are accepted. (Default: TRUE)

seed

The seed used by the RNG (Default: automatically set)

verbose

Verbosity (Default: TRUE)

Value

sr

A binary data frame with the simulated reports. The columns are named drug1, drug2 ..., event1, event2, ...

dag

The directed acycled graph as an igraph object

nodes

A tibble with all the information on each node/variate:

  • label The label for each node/variate

  • in_degree The number of edges pointing to the node

  • id The ID of each node (simple integer)

  • parent_id The ID of the parent node - if any. Otherwise equal to -1

  • margprob The marginal probability of the node/variate

  • beta0 The intercept in the logistic regression model for that node

  • beta1 The regression coefficient in the logistic regression model for the parent

prob_drugs

A vector with marginal probabilities of the drugs

prob_events

A vector with marginal probabilities of the events

See Also

convert2Tables, generateDAG


bips-hb/srsim documentation built on Dec. 10, 2020, 3:16 p.m.