[R] Help- Fitting a Thin Plate Spline

Simon Wood sw283 at bath.ac.uk
Thu Mar 17 12:36:56 CET 2011


library(mgcv)

b <- gam(arcsine.success ~ s(date.num,clutch.size,k=50))
vis.gam(b,theta=30)

will fit a thin plate spline and plot it. k is an upper limit on the 
number of degrees of freedom for the TPS, but the actual degrees of 
freedom are chosen automatically (use the 'method' argument of gam to 
choose exactly how). Increase k if 50 is overly restrictive here.

gam will also let you fit binary/binomial data directly, so you could 
probably do away with the arcsine transformation (if I'm guessing right 
about what you are doing here).

There are also several other libraries that will let you fit thin plate 
splines: gss, for example.

Simon




On 14/03/11 09:55, kehoe wrote:
> Hi Everyone,
>
> I'm a pretty useless r-er but have data that SPSS etc doesn't like. I've
> managed to do GLMs for my data, but now need to fit a thin plate spline for
> my data (arcsine.success~date.num:clutch.size)
> If anyone has a bit of spare time and could come up with a bit of code I'd
> be very grateful- I just don't get R language!
>
> Thanks
>
> Rach
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-Fitting-a-Thin-Plate-Spline-tp3353485p3353485.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
---
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 mailing list