How to specify a non-linear interaction term in a linear model Say I have 2 continuous variables (x & y) in a logit model. I want to test the following hypotheses in the model:

*

*For low values of x, increasing the value of y will increase the value of the response variable

*For high values of x, increasing the value of y will decrease the value of the response variable

Is there a way to specify this using interaction terms? I have only used interaction terms in which y has a linear impact on the effect of x on the response variable.
 A: In my comment I wrote that you could model the kind of nonlinearity you describe with a model such as the below model, which incorporates a "multiplicative interaction term."
$$\text{logit}({y_i}) = \beta_0 + \beta_{x}x_{i} + \beta_{z}z_{i} + \beta_{xz}xz_{i} + \varepsilon_{i}$$
Consider such a model where:

*

*$y_i$ is the value of the dependent (response) variable for the $i^{\text{th}}$ subject,

*$x_i$ is the value of the independent variable $x$ for the $i^{\text{th}}$ subject,

*$z_i$ is the value of the independent variable $z$ for the $i^{\text{th}}$ subject,

*$xz_{i}$ is the value of the product of $x$ and $z$ for the $i^{\text{th}}$ subject, and

*$\varepsilon_i$ is the value of the model residual for the $i^{\text{th}}$ subject.

Let's assume that $x$ and $y$ are continuous variables, but that $z$ is a nominal ($0/1$) variable. If $z=0$ then $\beta_{z}z_{i}=0$ and $\beta_{z}xz_{i}=0$, and the above model reduces to a simple bivariate logit regression of $y$ onto $x$, where $\beta_0$ is the $y$ intercept, and $\beta_{x}$ is how much the log-odds of $y$ changes given a 1-unit increase in $x$. However, if $z_{i}=1$, then the $y$ intercept becomes $\beta_0 + \beta_{z}z_{i}$ or $\beta_0 + \beta_{z}$ (since $z=1$). (Right? Because if $z_{i}=1$ then you add $\beta_{z}$, which is a scalar constant, to $\beta_{0}$: another scalar constant.) Similarly, the effect on the log-odds of $y$ of a 1-unit increase of $x$ becomes $\beta_{x} + \beta_{xz}$. (Right? Because if $z =1$, then $\beta_{xz}xz_{i} = \beta_{xz}x_{i}$, so when $x$ increases by 1-unit, the log-odds of $y$ changes by $\beta_{x}$, but also by $\beta_{xz}$.)
Application of this kind of mutiplicative interaction model is not limited to $z$ being nominal, however: $z$ can be continuous as well, in which case you simply need to plug the the specific value of $z$ to understand the effect of $x$ on the log-odds of $y$ and vice versa. With multiplicative interactions neither the effect of $\boldsymbol{x}$ nor the effect of $\boldsymbol{z}$ on $\boldsymbol{y}$ can be understood independently of one another.
Example
In the below graph we see two logistic curves of $y$ as modeled on $z$, the black one for values of $x = 0.1$ (i.e. "low"), and the red one for values of $x = 0.9$ (i.e. "high"). When $x$ is low the effect of $z$ on the log odds of $y$ is positive (i.e. as $z$ increases, the log odds of $y$ increases). When $x$ is high the effect of $z$ on the log odds of $y$ is negative (i.e. as $z$ increases, the log odds of $y$ decreases). This speaks precisely to your original question. The numerical specification of this relationship is:
$$\text{logit}({y_i}) = 1.25x_{i} + 2z_{i} - 3.75xz_{i}$$
Notice that by substituting $x_i = 0.1$, the (black line) model simplifies to one where the effect of $z$ is positive:
$$\begin{align*}\text{logit}({y_i}) & = 1.25\times 0.1 + 2z_{i} - 3.75\times 0.1 \times z_{i}\\
& = 0.125 + 2z_{i} - 0.375z_{i}\\
& = 0.125 + 1.625z_{i}\end{align*}$$
And notice that by substituting $x_i = 0.9$, the (red line) model simplifies to one where the effect of $z$ is negative:
$$\begin{align*}\text{logit}({y_i}) & = 1.25 \times 0.9 + 2z_{i} - 3.75 \times 0.9 \times z_{i}\\
& = 1.125 + 2z_{i} - 3.375z_{i}\\
& = 1.125 - 1.375z_{i}\end{align*}$$

A: It seems to me that you want:

*

*A two-way interaction, $XZ$, between $X$ and $Z$. This will estimate the expected change in the response for a 1 unit change in $X$, when $Z$ also changes by 1 unit.


*If you want this two-way interaction also to also vary with $X$ then you can interact the two-way interaction with $X$, which will be $X^2Z$. This 3-way interaction will estimate the expected change in the response for a 1 unit change in $X$ when the interaction $XZ$ also changes by 1 unit.
A: X1 =  I(x>a)
X2=  I (x<b)
Logit (Response ) = beta0 + betax * x + betay * x + betax1y * X1 * y + betax2y * X2 * y
Then X1y is activated when x is above a, X2 y when x is below b.
You can exclude betayy if you think that response is only through yx terms.
A and b are exogenous parameters in this model, so either outside knowledge or additional testing on which fit best is needed.
