glm.gaussian.covariate.fi: Calculate a fragility index for a coefficient test in a GLM...

Description Usage Arguments Value Examples

View source: R/front.R

Description

This function returns a fragility index (and accompanying information) for an interesting fragility index which only modifies a randomly observed covariate when testing the coefficient of another covariate such as an intervention. This is the only example in the package which modified a covariate instead of an outcome (or response). We assume that the distribution of the covariate is some Gaussian. We accomplish the fragility measure by putting the covariate in the Y argument of greedy.fi and the outcome in the X argument together with the intervention status. The function iteratively performs optimization using the Brent algorithm to find the best single modification for each patient.

Usage

1
2
3
4
5
6
7
8
9
glm.gaussian.covariate.fi(
  X.regr,
  y.regr,
  fam = binomial(),
  cl = NULL,
  verbose = TRUE,
  q = 0.9,
  alpha = 0.05
)

Arguments

X.regr

a numeric matrix giving the covariates in the regression. The first column must contain the covariate which is subject to modification.

y.regr

a numeric vector giving the response in the regression, with length equal to the number of rows in X.regr

fam

the family in a glm for the regression, by default binomial()

cl

A parallel cluster for faster calculation in greedy.fi, by default NULL

verbose

a boolean indicating whether to print status updates while running, by default TRUE

q

a numeric for the minimum probability of outcome changes, by default .7

alpha

a numberic for the significance threshold, by default 0.05

Value

The output of greedy.fi (a list) with an additional element which has the per-patient modification likelihood bound, as in the article Generalized fragility index.

Examples

1
2
3
4
5
6
7
8
9
set.seed(1234567890)
n.age <- 200
beta.age <- rep(.2, 3)
x.age <- rnorm(n.age)
z.age <- rbinom(n.age, 1, 1/2)
eta.age <- apply(t(beta.age*t(cbind(1,x.age,z.age))),1,sum)
y.age <- rbinom(n.age, 1, binomial()$linkinv(eta.age))

out <- glm.gaussian.covariate.fi(cbind(x.age, z.age), y.age, q = .7)

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