compute_dispro: Compute disproportionality

View source: R/compute_dispro.R

compute_disproR Documentation

Compute disproportionality

Description

[Stable] Computes bivariate (reporting) Odds-Ratio and Information Component for a drug-adr pair.

Usage

compute_dispro(
  .data,
  y,
  x,
  alpha = 0.05,
  na_format = "-",
  dig = 2,
  export_raw_values = FALSE,
  min_n_obs = 0
)

Arguments

.data

The data.table to compute from.

y

A character vector, one or more variable to explain (usually an adr).

x

A character vector, one or more explaining variable (usually a drug).

alpha

Alpha risk.

na_format

Character string to fill NA values in ror and ci legends.

dig

Number of digits for rounding (this argument is passed to cff)

export_raw_values

A logical. Should the raw values be exported?

min_n_obs

A numeric, compute disproportionality only for pairs with at least min_n_obs cases.

Details

Significance in pharmacovigilance analysis is only defined if the lower bound of the confidence/credibility interval is above 1 (i.e. low_ci > 1, or ic_tail > 0). Actually, the function computes an Odds-Ratio, which is not necessarily a reporting Odds-Ratio.

Value

A data.table, with ROR, IC, and their confidence/credibility interval (at 1 - alpha). Significance of both (as signif_or and signif_ic, if export_raw_values is TRUE).

A data.table with columns

  • y and x, same as input

  • n_obs the number of observed cases

  • n_exp the number of expected cases

  • orl the formatted Odds-Ratio

  • or_ci the formatted confidence interval

  • ic the Information Component

  • ic_tail the tail probability of the IC

  • ci_level the confidence interval level

  • Additional columns, if export_raw_values is TRUE:

  • a, b, c, d the counts in the contingency table

  • std_er the standard error of the log(OR)

  • or the Odds-Ratio

  • low_ci the lower bound of the confidence interval

  • up_ci the upper bound of the confidence interval

  • signif_or the significance of the Odds-Ratio

  • signif_ic the significance of the Information Component

See Also

compute_or_mod(), add_drug(), add_adr()

Examples

# Say you want to perform a disproportionality analysis between colitis and
# nivolumab among ICI cases

demo <-
  demo_ |>
  add_drug(
    d_code = ex_$d_drecno,
    drug_data = drug_
  ) |>
  add_adr(
    a_code = ex_$a_llt,
    adr_data = adr_
  )

demo |>
  compute_dispro(
    y = "a_colitis",
    x = "nivolumab"
  )

# You don't have to use the pipe syntax, if you're not familiar

compute_dispro(
    .data = demo,
    y = "a_colitis",
    x = "nivolumab"
  )


# Say you want to compute more than one univariate ror at a time.

many_drugs <-
  names(ex_$d_drecno)

demo |>
  compute_dispro(
    y = "a_colitis",
    x = many_drugs
  )


# could do the same with adrs

many_adrs <-
  names(ex_$a_llt)

demo |>
compute_dispro(
  y = many_adrs,
  x = many_drugs
)

# Export raw values if you want to built plots, or other tables.

demo |>
  compute_dispro(
    y = "a_colitis",
    x = "nivolumab",
    export_raw_values = TRUE
  )

# Set a minimum number of observed cases to compute disproportionality

demo |>
 compute_dispro(
 y = "a_colitis",
 x = "nivolumab",
 min_n_obs = 5
 )

vigicaen documentation built on April 3, 2025, 8:55 p.m.