Re: [R] mgcv::gam shrinkage of smooths

From: Simon Wood <>
Date: Mon, 12 May 2008 10:49:40 +0100

On Tuesday 06 May 2008 23:34, David Katz wrote:
> In Dr. Wood's book on GAM, he suggests in section 4.1.6 that it might be
> useful to shrink a single smooth by adding S=S+epsilon*I to the penalty
> matrix S. The context was the need to be able to shrink the term to zero if
> appropriate. I'd like to do this in order to shrink the coefficients
> towards zero (irrespective of the penalty for "wiggliness") - but not
> necessarily all the way to zero. IE, my informal prior is to keep the
> contribution of a specific term small.
> 1) Is adding eps*I to the penalty matrix an effective way to achieve this
> goal?
> 2) How do I accomplish this in practice using mgcv::gam?

Are you saying that you would like to specify the amount of shrinkage directly, with the degree of shrinkage set `by hand' or do you want mgcv::gam to estimate the degree of shrinkage?

If you want to supply a fixed ridge penalty then use argument `H' of mgcv::gam, which is designed for just this sort of purpose.

If you want what's suggested in section 4.1.6 then try s(...,bs="ts") or s(...,bs="cs").

If you want to add an extra ridge penalty to a smooth and have mgcv::gam estimate its smoothing parameter, then you would need to add write a smoother class to do this (by modifying one of the existing ones). See ?p.spline, or exercise 8, chapter 5 of Wood (2006) "GAMs:An Intro with R".



> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603
______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Mon 12 May 2008 - 09:59:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 12 May 2008 - 10:30:41 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive