[R] mgcv::gam shrinkage of smooths

Simon Wood s.wood at bath.ac.uk
Mon May 12 11:49:40 CEST 2008


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".

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