# Plugging in mean values/proportions to a logistic regression with continuous-discrete interaction

I have a logistic regression (in SAS, for reference) with continuous and categorical predictors (with reference coding), and an interaction term between one of each type (assume for now that the categorical variable in question has three response levels, reference coded to $c_1$ and $c_2$):

$logit(p) = a + (continuous terms) + (categorical terms) + b_1 (c_1 x) + b_2 (c_2 x)$

where $b_1$ and $b_2$ are the estimated coefficients from my code. From this I can obviously get an expression for the probability $p$ of my outcome. I want to estimate the average p by plugging in the means of the continuous terms and the proportions of the categorical terms. But what do I do with the interaction term(s)? Do I set $(c_i x) = mean(x)$? Or do I set it to $proportion(c_i)mean(x)$?

• Over what probability distribution do you intend to form an average, David? – whuber Oct 15 '10 at 14:23

## 2 Answers

Regardless of the interaction term, this procedure isn't going to estimate the average p, because logit is a nonlinear function so the mean of the logit isn't the same as the logit of the mean. If you want to calculate the expected proportion of positive outcomes in a sample, the easiest way is to calculated the predicted p for each individual and average them.

• +1 for noting the nonlinearity. But your use of the phase "expected proportion" seems to assume the data are a random sample of the distribution over which one is averaging and that's often not the case. – whuber Oct 15 '10 at 14:22
• Argh, yes, I realised this after some guys at work raised some objections about the categorical variables (interestingly, they didn't complain about the continuous variables!). The problem is even more complicated than I outlined, so I need to think about things a bit more. – David Roberts Oct 17 '10 at 21:51

The predicted grand average (see onestop's answer) may not be all that informative - after all, you are fitting a model to understand systematic deviations from it.

You can predict your p for any setting of your predictors. Given that you are interested in the effects of the predictors, it would make sense to look at what happens when your continuous x takes values at the first, second and third quartile of the values in your sample, while the categorical predictor varies over the categories you have.

Then again, you sound like you have more than one continuous and more than one categorical variable, in which case an enumeration as I proposed in the previous paragraph becomes unintelligible. Better look at and report p for "interesting" or "relevant" predictor settings.