Description Usage Arguments Value Examples
This function calculates the stochastic generalized fragility indices, which are a stochastic version of the generalized fragility indices. They ensure that a random collection of patients can reverse significance with sufficiently high probability, thus ensuring that typical patients can reverse significance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
X |
a data frame of covariates which are not subject to modification. |
Y |
a data frame of responses which are subject to modification. |
get.replacements |
a function which outputs a data frame containing all possible row replacements for Y which are to be considered. The functions inputs the row of Y under consideration, the row of X under consideration, the row name, and the full original data frames X and Y. |
get.p.val |
a function that inputs X and Y and returns a p value |
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 |
D |
a parameter for Polyak-Ruppert averaging, by default 20 |
gamma |
a parameter for Polyak-Ruppert averaging, by default 0.2 |
init.step |
a parameter for Polyak-Ruppert averaging, by default TRUE |
gfi.init |
An initialization of the output size, by default 10 |
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.
1 2 3 4 5 6 7 | n <- 100
X <- data.frame("tr_group" = sample(c("treated", "not treated"), n, TRUE))
Y <- data.frame("outcome" = sample(c("sick", "healthy"), n, TRUE))
get.p.val <- function(X, Y) fisher.test(table(X[[1]], Y[[1]]))$p.value
get.replacements <- function(y, x, rn, Y, X) data.frame(Y=setdiff(unique(Y[[1]]), y))
stochastic.fi(X, Y, get.replacements, get.p.val)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.