[R] GAM without intercept
s.wood at bath.ac.uk
Fri Oct 12 10:49:04 CEST 2012
Smooth terms are constrained to sum to zero over the covariate values.
This is an identifiability constraint designed to avoid confounding with
the intercept (particularly important if you have more than one smooth).
If you remove the intercept from you model altogether (m2) then the
smooth will still sum to zero over the covariate values, which in your
case will mean that the smooth is quite a long way from the data. When
you include the intercept (m1) then the intercept is effectively
shifting the constrained curve up towards the data, and you get a nice fit.
So it's not quite true that m2 has nothing to do with the data. The
curve you get is as close to the data as a curve constrained to average
to zero can get.
On 10/10/12 23:22, SAEC wrote:
> Hi everybody,
> I am trying to fit a GAM model without intercept using library mgcv.
> However, the result has nothing to do with the observed data. In fact
> the predicted points are far from the predicted points obtained from the
> model with intercept. For example:
> #First I generate some simulated data:
> #then I fit a gam model with and without intercept
> #and now I obtain predicted values for the interval 0-1
> #plotting predicted values
> In this example you can see that the red line are the predicted points
> from the model with intercept which fit pretty good to the data, but the
> blue line (without intercept) is far from the observed points.
> Probably I missunderstanding some key elements in gam modelling or using
> incorrect syntaxis. I don't know what the problem is. Any ideas will be
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603 http://people.bath.ac.uk/sw283
More information about the R-help