I'm developing a logistic regression where one of the independent variables has a non-linear relationship to the probability of the event occurring.

I have created linear splines based on this variable - the reason being that for its intended application, its relationship to the response must be monotonic, and the knots set to specific values.

The coefficient of the last spline however makes the relationship non-monotonic (i.e. it has a different sign than the other splines).

What are the potential issues that might arise if I were to not include the final spline in the regression (in effect censoring the original variable)?

Is there any other way of addressing this problem?


Right now you are fitting a normal spline and hope that it will turn out monotone. Ideally you would fit a spline which would be monotone by definition. The requirements for monotonicity of a piece-wise linear spline are complicated. It is much simpler for the I-splines. They produce a monotone fitted curve if all the regression coefficients are non-negative. For example look at the I-splines of order 1 (which is basically just a reparameterization of the standard piece-wise linear splines): $$ b_k^{I\text{-spline}}(x)=\begin{cases} \frac{1}{\xi_{k+1}-\xi_k} (x-\xi_k)_+ \quad &\text{for }x<\xi_{k+1}\\ 1 & \text{else}. \end{cases} $$ A curve fitted with those splines are clearly non-decreasing if and only if all regression coefficients are non-negative.

However, constraining parameters in the optimization process is not easy/common. In R, there are - to my knowledge - only a few packages that optimizes some regression types with constraints; nnls handles least squares regression and addreg handles poisson, binomial and negative binomial (only with identity link). I am afraid you will have to implement non-negative logistic regression yourself if you want to use it.

You also suggest leaving out the last spline. It is equivalent to removing the last knot from the splines, which would not be bad; the fitted curve would still be piecewise linear and interpretable using the remaining knots. The biggest problem is the (small) model selection bias that arises from rejecting the first model with all knots. So if removing the last knot (and rerunning the analysis) luckily produces a monotone fitted curve, I think you can use it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.