`gam` package: extra shift spotted when sketching data on `plot.gam`
<p>I try to fit a GAM using the <code>gam</code> package (I know <code>mgcv</code> is more flexible, but I need to use <code>gam</code> here). I now have the problem that the model looks good, but in comparison with the original data it seems to be offset along the y-axis by a constant value, for which I cannot figure out where this comes from.</p>

<p>This code reproduces the problem:</p>

<pre><code>library(gam)
data(gam.data)
x &lt;- gam.data$x
y &lt;- gam.data$y
fit &lt;- gam(y ~ s(x,6))

fit$coefficients
#(Intercept)     s(x, 6) 
#   1.921819   -2.318771

plot(fit, ylim = range(y))
points(x, y)
points(x, y -1.921819, col=2)
legend("topright", pch=1, col=1:2, legend=c("Original", "Minus intercept"))
</code></pre>

<p><a href="https://i.stack.imgur.com/6Nc4f.png" rel="nofollow"><img src="https://i.stack.imgur.com/6Nc4f.png" alt="enter image description here"></a></p>

<p><em>Chambers, J. M. and Hastie, T. J. (1993) Statistical Models in S (Chapman &amp; Hall)</em> shows that there should not be an offset, and this is also intuitively correct (the smooth should describe the data).</p>

<p>I noticed something comparable in <code>mgcv</code>, which can be solved by providing the <code>shift</code> parameter with the intercept value of the model (because the smooth is seemingly centred). I thought the same could be true here, so I subtracted the intercept from the original data-points. However, the plot above shows this idea wrong. I don't know where the extra shift comes from. I hope someone here may be able to help me.</p>

<p>(R version. 3.3.1; <code>gam</code> version 1.12)</p>