| Title: | Odds Ratios, Contingency Table, and Model Significance from a Generalized Linear Model Object |
|---|---|
| Description: | Computes odds ratios and 95% confidence intervals from a generalized linear model object. It also computes model significance with the chi-squared statistic and p-value and it computes model fit using a contingency table to determine the percent of observations for which the model correctly predicts the value of the outcome. Calculates model sensitivity and specificity. |
| Authors: | Jenine Harris [aut, cre] |
| Maintainer: | Jenine Harris <[email protected]> |
| License: | CC0 |
| Version: | 0.1.4 |
| Built: | 2026-05-31 09:08:01 UTC |
| Source: | https://github.com/jenineharris/odds.n.ends |
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.
odds.n.ends( mod, thresh = 0.5, rocPlot = FALSE, predProbPlot = FALSE, color1 = "#7463AC", color2 = "deeppink" )odds.n.ends( mod, thresh = 0.5, rocPlot = FALSE, predProbPlot = FALSE, color1 = "#7463AC", color2 = "deeppink" )
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 |
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)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)