# Monotonic constraints in regression model with interaction

I'm trying to figure out what constraints I need to use to have monotonicity (both on $x$ and $z$) on the regression model with interaction. My model is:

$$\mathbb{E}[Y|x,z]= \beta_0+\beta_1x+\beta_2z+\beta_3xz,$$

thus, to get an increasing function in x and z, I need the derivatives wrt x and z to be positive: $$\beta_1+\beta_3z\ge0 \quad\text{ and } \quad\beta_2+\beta_3x\ge0$$

If x and z are both positive, I conclude: $\beta_i \ge 0, \quad i= 1,\ldots,3$.

Since I would estimate the model with standardised $x$ and $z$, I also can have negative values. How can I solve the system in that case?

Thanks for your help.

• Why do you need these constraints? Imposing such constraints based on pre-conceptions about response-surface shapes can be unwise. – EdM Jan 27 '18 at 19:20
• How do you derive this conclusion? If $x$ and $z$ can be arbitrarily large, then you cannot have $\beta_3$ be negative. Note, too, that this surface (qua function of $(x,z)$) is not a plane: it's a piece of a hyperboloid. – whuber Jan 27 '18 at 19:22
• I need them because is a dose-response relation and I need to constraint the surface to be monotonic increasing. – Prunus avium Jan 27 '18 at 19:22
• You're right @whuber, thanks. I can't consider the derivative without x and z just because they are positive. I'm going to correct my post! – Prunus avium Jan 27 '18 at 19:30
• Also, dose-response curves often display hormesis in practice, non-monotonic shapes. Don't restrict your analysis unnecessarily; that might not be consistent with the underlying reality. – EdM Jan 28 '18 at 2:33

## 1 Answer

These types of constraints are linear in the variables, and a linear regression with linear constraints become a linearly constrained quadratic programming (QP) problem. Most regression solvers do not allow such constraints, but you can formulate it yourself and use an open source QP solver such as cvxopt (python).

For the relationship between QP and linearly constrained linear regression problems, see here.