bin.fi.stochastic: Stochastic generalized fragility indices for 2x2 tables

Description Usage Arguments Value Examples

View source: R/internal.R

Description

Use bin.fi instead of this function. This is an internal function which calculates stochastic generalized fragility indices for 2x2 tables in a more optimized way than stochastic.fi.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
bin.fi.stochastic(
  crosstab,
  get.p,
  can.vary = matrix(rep(TRUE, 4), nrow = 2),
  r = 0.5,
  nsim = 10,
  qfi.init = 10L,
  alpha = 0.05,
  verbose = FALSE,
  cl = NULL,
  D = 40,
  gamma = 0.2
)

Arguments

crosstab

a 2x2 contingency table with interventions on rows and outcomes on columns

get.p

a function that inputs a matrix and returns a p value

can.vary

a 2x2 boolean matrix for whether each entry can decrease. See the incidence fragility index article for explanation.

r

the index of the stochastic fragility index, by default 0.5. Having r=0 is equivalent to the generalized fragility index and having r=1 means that all patient combinations of the output size can reverse significance.

nsim

The number of simulations in the root finding algorithm, by default 10

alpha

a numeric for the significance cutoff

verbose

a logical value for whether to print status updates while running

cl

a cluster from the parallel package, used to compute fragility index over each modified observation at each stage of the greedy algorithm

D

a parameter of Polyak-Ruppert averaging, by default 40

gamma

a parameter of Polyak-Ruppert averaging, by default .2

gfi.init

An initialization of the output size, by default 10

Value

a length 2 list, with the first entry giving the stochastic generalized fragility index and the last entry giving the history of the root finding algorithm.

Examples

1
2
3
4
5
x <- matrix(nrow = 2, byrow = TRUE, rgeom(4, 1 / 50))
colnames(x) <- c("event", "nonevent")
rownames(x) <- c("control", "treatment")
get.p <- function(tab) fisher.test(tab)$p.value
FragilityTools:::bin.fi.stochastic(x, get.p)

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