I am modeling a binary event of whether a sale will happen or not for an online retailer. I have millions of clicks to refer to. Needless to say the rate of sales happening is very very low (<1%). Now, to model this event, I am taking the product price to be one of the predictor variables that i am passing in the logistic model.

  1. Right now, I am using the linear piece wise models or linear splines. However, I read in a paper that Cubic splines are better if the distribution is highly non linear. What should be an objective way to gauge that cubic splines should be used or not?
  2. Currently I am creating knots based on the business sense and intuition. Is there a better way to know the number of knots and their placements?
  3. In one of the test runs, I found that interaction between price and sellers (again one of the predictor variables!) plays an important role. Do you think that it can also explain some non linearity?

Now, I know that interaction and splines both should help me with the non linearity in my independent variable. Which one should I choose or how to decide if I should go with a combination of both of them?


1 Answer 1


Without going into detail,

  • cubic splines have advantages over linear splines, namely more properly reflecting smooth underlying relationships and being less sensitive to knot placement
  • knots can be placed using subject matter knowledge or using the observed data density (e.g., put knots at fixed quantiles of a predictor)
  • getting nonlinear main effects right by modeling them flexibly is necessary before considering interactions
  • interactions between regression splines are called tensor splines and can give you a smooth interaction surface. This involves taking all products of terms making up the regression splines in the main effects
  • think about how the number of purchases guides the estimation of how many parameters (degrees of freedom) to spend on each predictor and on the interactions
  • the R rms package has a restricted interaction operator %ia% to create tensor splines with fewer terms. The restriction is that the interactions are not doubly nonlinear.
  • $\begingroup$ Could you expand on the third point? - non-linearity before non-additivity. $\endgroup$ Nov 27, 2013 at 20:34
  • 1
    $\begingroup$ What I mean is that interactions can be overstated because of underfitting (by falsely assuming linearity) or omitting main effects. $\endgroup$ Nov 28, 2013 at 4:39
  • $\begingroup$ What does "doubly nonlinear" mean? Does it mean that iteractions should be of the form x1*s(x2) rather than s(x1, x2)? $\endgroup$
    – KH Kim
    Nov 13, 2018 at 12:10
  • $\begingroup$ Example: if modeling a quadratic effect in two predictors the biggest model would have x1 + x1^2 + x2 + x2^2 + x1*x2 + x1*x2^2 + x1^2*x2 + x1^2*x2^2. Doubly nonlinear term is the last one. $\endgroup$ Nov 13, 2018 at 18:02
  • $\begingroup$ I'm not familiar with tensor splines... I hope they include some regularization. $\endgroup$ Nov 13, 2018 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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