logisticfragility: Logistic Fragility Function

Description Usage Arguments Value Examples

View source: R/logisticfragility.R

Description

Compute the fragility of a coefficient in a logistic regression for dichotomous outcomes, i.e. the number of removed observations it would take to make a significant-result non-significant. Uses the glm() function from the stats package.

Usage

1
2
logisticfragility(formula, data, covariate = "all.factors.default",
  conf.level = 0.95, verbose = FALSE)

Arguments

formula

Model formula which will be evaluated by glm()

data

Dataframe with values for model forma, passed to glm()

covariate

Vector of covariates to find fragility index for. Default is all covariates in formula

conf.level

Significance level

verbose

Logical indicating if function will return verbose results or only fragility index

Value

If verbose is FALSE, returns a list with fragility indices for selected covariates. If verbose is TRUE, returns a list with p-values for each fragility index at each iteration of the algorithm.

Examples

1
2
3
4
5
6
7
# Import and format example data
mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv")
mydata$rank <- factor(mydata$rank)

logisticfragility(admit ~ gre + gpa + rank, data = mydata, covariate="gpa", verbose = TRUE)

logisticfragility(admit ~ gre + gpa + rank, data = mydata)

fragilityindex documentation built on July 18, 2017, 1:02 a.m.