1
$\begingroup$

This is probably a very crude question and I've been thinking about it for a while. Is the odds ratio the same for generalized additive models (GAMs) as it is with generalized linear models (GLMs)? If no, then how can I interpret them in a logistic GAM? I found many links about odds ratios for GAMMs but not GAMs.

$\endgroup$
1
  • $\begingroup$ Maybe the slides 60 to 69 from this excellent workshop could bring some light? $\endgroup$
    – denis
    Apr 15, 2023 at 16:53

1 Answer 1

0
$\begingroup$

First, generalized additive mixed models (GAMMs) are just extensions of generalized additive models (GAMs), so the interpretation of their respective odds ratios is pretty much the same, though of course you are adding in the extra information about random effects. That isn't all that important for your question though.

Remember that odds ratios in generalized linear models (GLMs) are based off single coefficients. Recall that a GAM fit is based off the estimation of multiple coefficients using a spline, and this consequently alters how odds ratios (ORs) can be interpreted. As an example, if the data is fit to an almost parabolic association between the predictor and outcome, the odds ratios for each section of this regression would have opposite interpretations.

To show this in action, one can use the oddsratio package on a given GAM to check for specific regions of a regression line and it's associated OR. I have used the example given on the oddsratio package vignette page so you can check through the documentation yourself. Below is a GAM fitted from the data_gam data in the oddsratio package. We use the or_gam function by specifying a specific zone of values and it's associated OR:

#### Load Libraries ####
library(oddsratio)
library(tidyverse)

#### Fit GAM ####
fit_gam <- mgcv::gam(y ~ s(x0) + s(I(x1^2)) + s(x2) + offset(x3) + x4,
                     data = data_gam
)

#### Check OR for "Cut" ####
or_gam(
  data = data_gam, model = fit_gam, pred = "x2",
  values = c(0.099, 0.198)
)

This area of the regression has a considerable OR, as from .099 and .198, there is an associated OR of 23. We can also fit these sections to a plot to visualize what they are saying. You first create a ggplot based object with plot_gam, then create an OR-based object with or_gam, then layer them on top of each other to create a plot with the region of interest.

#### Create Plot Object ####
plot_object <- plot_gam(fit_gam, pred = "x2", title = "Predictor 'x2'")

#### Create OR Object ####
or_object <- or_gam(
  data = data_gam, model = fit_gam,
  pred = "x2", values = c(0.099, 0.198)
)

#### Insert OR Object into Plot Object ####
plot <- insert_or(plot_object, or_object,
                  or_yloc = 3,
                  values_xloc = 0.05, arrow_length = 0.02,
                  arrow_col = "red"
)

#### Generate OR Plot ####
plot +
  theme_minimal()

enter image description here

The OR associated with this range makes sense...there is a pretty linear positive trend here. If we fit it to somewhere else with a negative trend:

#### Create OR Object ####
or_object <- or_gam(
  data = data_gam, model = fit_gam,
  pred = "x2", values = c(0.3, 0.4)
)

#### Insert OR Object into Plot Object ####
plot <- insert_or(plot_object, or_object,
                  or_yloc = 3,
                  values_xloc = 0.05, arrow_length = 0.02,
                  arrow_col = "red"
)

#### Generate OR Plot ####
plot +
  theme_minimal()

We get an almost negligible OR:

enter image description here

So to summarize, the OR is dependent on where you are looking, but in general it can be interpreted in a similar way.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.