bin.fi: Calculates a fragility index for 2x2 data

Description Usage Arguments Value Examples

View source: R/front.R

Description

This is a function which is a wrapper around several general purpose functions to calculate fragility indices. Several algorithms and several methodologies can be employed to find various fragility indices for 2x2 tables. The function supports allowing only sufficiently likely modifications, as described in the article Incidence fragility index.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
bin.fi(
  crosstab = NULL,
  X = NULL,
  Y = NULL,
  alg = "greedy",
  test = "fisher",
  alpha = 0.05,
  q = 0,
  r = 0,
  verbose = FALSE,
  fi.start = NULL,
  delta = NULL,
  nsim = 10
)

Arguments

crosstab

a 2x2 contingency table, stored as a matrix or table. Either input a data table or both X and Y.

X

a dataframe representing the covariates. Either input a data table or both X and Y.

Y

a dataframe representing the responses. Either input a data table or both X and Y.

alg

a string specifying the FI algorithm, 'exact', 'original', 'original.bothdir', 'greedy', or 'hybrid'. The exact algorithm is described in the Incidence fragility index article. It will return the exact fragility index possibly at the cost of longer run time. The original algorithm runs the algorithm proposed by Walsh et al. (2014). The 'original.bothdir' algorithm runs a natural variant of the original algorithm which allows for searching in both directions of the chosen group. The greedy algorithm is described in Generalized fragility index and efficiently upper bounds the fragility index. The hybrid approach first runs the greedy algorithm and then finetunes the output similar to the exact algorithm.

test

a string specifying the test, defaulting to 'fisher' for the Fisher exact test. Some alternatives are 'fisher.midp', 'pearson.chisq', 'ni.normal'.

alpha

a number for the size of test, default 0.05.

q

the minimum probability of permitted outcome modifications, defaults to 0 (permitting all modifications). Note that alg='original' and alg='original.bothdir' do not support this option.

r

the minimum probability that a patient combination can reverse significance, default to 0 (reducing to the standard fragility index). Use alg='greedy' if r > 0.

verbose

a logical value for whether to print status updates while running

fi.start

the starting fragility index considered in the exact algorithm.

delta

the noninferiority margin for when test='ni.normal'

nsim

The number of simulations in the root finding algorithm when r>0, by default 10

Value

a list containing the fragility index and other values, depending on which algorithm is specified. The name of the fragility index in the list is 'FI'

Examples

1
2
3
4
5
x <- matrix(nrow = 2, byrow = TRUE, c(5, 100, 30, 70))
colnames(x) <- c("event", "nonevent")
rownames(x) <- c("treatment", "control")
bin.fi(crosstab = x, alg = "greedy", q = .5, verbose = FALSE)$FI
bin.fi(crosstab = x, alg = "exact", q = .01, verbose = FALSE)$FI

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