Search code examples
pythonsplinepatsy

python patsy intercept term in cubic splines


I'm trying to understand cubic spline generation in patsy library of python. As far as I can see from the output of

import numpy as np
from patsy import dmatrix

x = np.linspace(0., 1., 100)
y1 = dmatrix("bs(x, df=6, degree=3, include_intercept=True)", {"x": x})
print(y1)
y2 = dmatrix("bs(x, df=6, degree=3, include_intercept=False)", {"x": x})
print(y2)

the y1 (with intercept) and y2 (without intercept) are the same. Is there something I am missing? Thanks!


Solution

  • This was answered on the patsy issue tracker:

    https://github.com/pydata/patsy/issues/108#issuecomment-309234408

    tl;dr: they are different, but eyeballing big matrices full of floating point numbers is hard :-)