rir: Bayesian RIR calculation

Description Usage Arguments Value Examples

View source: R/front.R

Description

The Bayesian RIR is a Bayesian view of the the Robustness of an Inference to Replacement proposed by Frank et al. (2021). Unlike the RIR, it takes the posterior expectation of the final quantity in the definition of the RIR. This is explained in more detail in a letter to the editor to Frank et al. (2021) in the Journal of Clinical Epidemiology.

Usage

1
2
3
4
5
6
7
rir(
  mat,
  get.p = function(mat) fisher.test(mat)$p.value,
  alpha = 0.05,
  iters = 10000,
  cl = NULL
)

Arguments

mat

a 2 x 2 contingency table of counts. The treatment should be on the first row and the event should be on the first column

get.p

a function which inputs a 2x2 matrix and outputs a p value (numeric)

alpha

a numeric for the significance threshold, by default 0.05

iters

the number of monte carlo iterations, by default 10000

cl

A parallel cluster to parellelize the monte carlo iterates, by default NULL

Value

a length 2 numeric vector, giving the conditional posterior mean number of replacements and the posterior probability of reversing not being possible

Examples

1
2
walter.mat <- structure(c(0, 5, 96, 90), .Dim = c(2L, 2L)) # data from Walter, in correct formatting
rir(walter.mat)

brb225/FragilityTools documentation built on Jan. 21, 2022, 1:26 a.m.