bin.fi.exact2: Exactly calculate a fragility index for 2x2 data (2.0)

Description Usage Arguments Details Value Examples

View source: R/internal.R

Description

Do not call this function: use bin.fi with option 'exact' instead The algorithm starts at a given FI value and radiates outward from there. Note this can use an increasing or decreasing search, depending on the input.

Usage

1
2
3
4
5
6
7
8
9
bin.fi.exact2(
  crosstab,
  get.p,
  alpha = 0.05,
  fi.start = 1,
  can.vary = matrix(rep(TRUE, 4), nrow = 2),
  start.reversed = FALSE,
  start.p = NA
)

Arguments

crosstab

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

get.p

a function inputting a table and outputting a p-value

alpha

a scalar numeric for the significance cutoff

fi.start

The starting fi considered, by default 1.

can.vary

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

start.reversed

a boolean for whether the start.fi value already reverses statistical significance. Note, FALSE just means unknown. (note: in a future update, this will be true/false/na)

start.p

The p value of the table with reversed statistical significance, paired with the parameter start.reversed. Defaults to NA when knowledge of reversal is not known

Details

Do not call this function: use bin.fi with option 'exact' instead. If bin.fi.exact2 is initialized with too large of a value, the algorithm could malfunction. It's best to leave the default behavior unless sure.

Value

a list containing the signed fragility index and other accompanying values, similar to greedy.fi

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.exact2(x, get.p)

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