# Interpreting probability from the inverse logit function

I'm doing a study using generalized linear models to investigate effect size and direction of species whose presence/absence were found to be affected by the presence of drought (tested by a Fisher's Exact Test). To do the results easy to interpret, I did the following:

1) I produced a binomal GLM.

2) For presence and absence of a particular species, I converted the non-standardized logistic regression coefficients given by the GLM for the intercept-only model (the null model) and the intercept + drought presence and absence model (the alternative model) to the log-odds probability (using the logit function, where β0 represents the intercept and β1x1 represents drought presence/absence). I did this for drought and for non-drought separately.

3) I converted log-odds probability to probability of detection for drought and non-drought (using the inverse of the logit function), and compared these probabilities of detection within each species during drought and non-drought.

The equations used are as follows:

for (2) logit (α) = β0 + β1x1

for (3) logit^-1 (α) = e^α / (1 + e^α)

The issue is that a couple species do not at all represent reality, even if the patterns are correct. For example, a bird that is detected 60% of the time during drought and 25% of the time during non-drought (from the raw data), after running the GLM, and converting to probability, the model said there's a 58% chance of detecting the bird (instead of somewhere near 25%) during non-drought and a 96% chance of detecting the bird (instead of 60%) during drought. The true probability can't be anywhere near 96%, right? This bird is not that common. Should I not be interpreting these values as true probabilities? How should I be interpreting this 96%? Did I do something wrong? Thank you for any and all help!

• This might help. Could you write down the full model you ran with all of the variables? Right now it's a little ambiguous what models you ran (e.g., why did you run an intercept-only model?).
– Noah
Mar 29, 2020 at 7:23
• Here's an example with data. I think it is consistent with the link you provided. Here's a bird we will call species 29. I did all of this using the glm(binomial) in R. Logistic regression coefficients: Intercept (null model=no drought): 0.3393 Y1 (model with drought): 2.9188 Logit function: Drought absent: 0.3393 Drought present: 0.3393 + 2.9188(1) = 3.26 Inverse of logit function (probability of detection): Drought absent: (e^0.3393) / (1 + e^0.3393) = 0.584 Drought present: (e^3.26) / (1 + e^3.26) = 0.963 Any help you can provide is much appreciated! Mar 30, 2020 at 17:20

You don't need to fit a full model. You only need to fit a single logistic regression model to get the predicted probabilities of detection under each drought scenario.

fit <- glm(detected ~ drought, data = data, family = binomial)
#Probability of detection under no drought
plogis(coef(fit))
#Probability of detection under drought
plogis(sum(coef(fit)))


These should match the empirical probabilities exactly (i.e., plogis(coef(fit)) == with(data, mean(detected[drought == 0])))

The null model is not helpful here. The intercept in the null model gives you the marginal log odds of detection (i.e., which can be transformed into the probability of detection for the whole sample ignoring whether there was a drought).

• Thank you! Is there somewhere I can read up on to get more familiar with the information you provided? Mar 30, 2020 at 17:24
• There are many good introductions to logistic regression. I learned just by taking classes in graduate school but the book by Hosmer and Lemeshow is a nice introduction.
– Noah
Mar 30, 2020 at 17:28
• Thanks. What should I enter as far as the code for these commands? Specifically, #Probability of detection under no drought plogis(coef(fit)) #Probability of detection under drought plogis(sum(coef(fit))) These should match the empirical probabilities exactly (i.e., plogis(coef(fit)) == with(data, mean(detected[drought == 0]))) My variables are "VER_S" for drought present (1) or absent (0) and "Present" for presence (1) or absence (0). Mar 30, 2020 at 17:37
• fit <- glm(Present ~ VER_S, data = DATA, family = binomial) but replace DATA with the name of your data set.
– Noah
Mar 30, 2020 at 22:08