Re: [R] mgcv: I can't manually reconstruct a P-spline from a GAM's coefficients

2014-06-18 Thread Simon Wood
mgcv:gam automatically imposes sum-to-zero constraints on the smooths in a model (even if there is only one smooth). This is to avoid lack of identifiability with the intercept. The constraint removes one coefficient and shifts the curve... best, Simon On 17/06/14 15:40, Alexander Engelhardt

Re: [R] mgcv: I can't manually reconstruct a P-spline from a GAM's coefficients

2014-06-18 Thread Alexander Engelhardt
Hello Simon, thanks for your response! I incorporated the intercept, i.e. coef(my_gam)[1] into the spline. That is, my B-spline coefficients are the intercept for the first one, and for all others I added the intercept to them (see the code below if I'm not clear) Now I *almost* reproduce

[R] mgcv: I can't manually reconstruct a P-spline from a GAM's coefficients

2014-06-17 Thread Alexander Engelhardt
Hello R-helpers, I am working through Simon Wood's GAM book and want to specify my own knot locations (on even tens, i.e. 10, 20, 30, etc.). Then, I want to compute a GAM on that area, and given the coefficients, reconstruct the same P-spline that is drawn in plot(my_gam). I'm failing. Here