odds.n.ends: A binary logistic regression function

Description Usage Arguments Examples

View source: R/or_function.R

Description

This function allows you to compute model significance (model chi-squared), model fit (percent correctly predicted, sensitivity, specificity), ROC plot, predicted probability plot, and odds ratios with 95 percent confidence intervals for a glm object from a binary logistic regression analysis.

Usage

1
2
3
4
5
6
7
8
odds.n.ends(
  mod,
  thresh = 0.5,
  rocPlot = FALSE,
  predProbPlot = FALSE,
  color1 = "#7463AC",
  color2 = "deeppink"
)

Arguments

mod

is a glm object

thresh

is the threshold between 0-1 for predicted prob to be considered a case

rocPlot

is TRUE or FALSE to display an ROC plot

predProbPlot

is TRUE or FALSE to display predicted prob histogram by outcome value

color1

choose color for plot

color2

choose 2nd color for plot

Examples

1
2
3
4
sick <- c(0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1)
age <- c(23, 25, 26, 34, 54, 46, 48, 95, 81, 42, 62, 25, 31, 49, 57, 52, 54, 63, 61, 50)
logisticModel <- glm(sick ~ age, na.action = na.exclude, family = binomial(logit))
odds.n.ends(mod = logisticModel)

odds.n.ends documentation built on Sept. 18, 2021, 1:07 a.m.