[R] GAM with constraints
Simon Wood
s.wood at bath.ac.uk
Fri Nov 30 09:03:48 CET 2007
> > Are you interested in equality constraints or inequality constraints?
>
> No, I am interested in 2 kinds of inequality constraints:
> 1) monotonic splines
> 2) positive coefficients of the variables, which are not splines.
> It seems that pcls should be able to deal with both of them, if smoothing
> parameters are given, should it not?
-- yes that's right
> Simon Wood-4 wrote:
> > `pcls' is really useful for the inequality constraint case (e.g. when you
> > want
> > shape preserving smooths). For fixed smoothing parameters you can embed
> > this
> > in an IRLS loop for gam fitting also, but convergence can be tricky, and
> > smoothing parameter selection not so straightforward.
>
> The question here is how one can obtain smoothing parameters, given
> inequality constraints. I've read your article "Monotonic smoothing splines
> fitted by cross-validation", where you explain how the penalties are
> calculated. Is there a routine in R that can do it?
--- Not exactly, but you both `magic' and `pcls' with apply the correct
transformation to the penalties if supplied with the constraints. If you
really need the transformed penalties then take a look at mgcv::smoothCon
> I want to build a GAM regression with constraints using performance
> iteration, which updates the penalties taking the constraints in account.
--- Do you mean that at each stage you want to select smoothing parameters
using the working model of the P-IRLS, but in the null space of the active
constraints from a constrained fit? If so, then you'd just need to identify
which constriants are active (which just means checking which are satisfied
exactly on exit from pcls), and then use the active set as the equality
constraint set for `magic'. No direct manipulation of the penalties should be
needed, although you could absorb the constraints before calling magic, of
course.
--- this would be an appealing approach *if* it converges, but I'm not sure
that it will, in general [I'm not sure that it won't either].
> Do you think this would improve the model compared to one where penalties
> are generated without constraints, and then the coefficients are calculated
> using pcls() with all the constraints?
--- sorry I don't follow this.
best,
Simon
--
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603 www.maths.bath.ac.uk/~sw283
More information about the R-help
mailing list