Resource: CRAN Travis CI Appveyor
Platforms: Multiple Linux & macOS Windows
R CMD check CRAN version Build status Build status
Test coverage Coverage Status


CRAN_Status_Badge Downloads

Functions for calculation and plotting of odds ratios of Generalized Additive (Mixed) Models and Generalized Linear (Mixed) Models with a binomial response variable (i.e. logistic regression models).


Install from CRAN:

Get the development version from Github:




Odds ratio calculation of predictors gre & gpa of a fitted model fit_glm with increment steps of 380 and 5, respectively.
For factor variables (here: rank with 4 levels), automatically all odds ratios corresponding to the base level (here: rank1) are returned including their respective confident intervals. The default level is 95%. However, other levels can be specified with the param CI. Data source:


For GAMs, the calculation of odds ratio is different. Due to its non-linear definition, odds ratios do only apply to specific value changes and are not constant throughout the whole value range of the predictor as for GLMs. Hence, odds ratios of GAMs can only be computed for one predictor at a time by holding all other predictors at a fixed value while changing the value of the specific predictor. Confident intervals are currently fixed to the 95% level for GAMs. Data source: ?mgcv::predict.gam()

Here, the usage of or_gam() is shown by calculating odds ratios of pred x2 for a 20% steps across the whole value range of the predictor.

If you want to compute a single odds ratio for specific values, simply set param slice = FALSE:

Plotting of GAM smooths is also supported:

plot_gam(fit_gam, pred = "x2", title = "Predictor 'x2'")

Insert the calculated odds ratios into the smoothing function:

Insert multiple odds ratios into one smooth: