Is the variable to be used as a predictor? If so mgcv::gam has a couple of circular smoother built in...
s(x,bs="cc") or s(x,bs="cp") (if the range of x is less than the full [0, 360] then you can supply a `knots' argument to gam to force the x range to go from 0 to 360, otherwise s(min(x), bs="c*") will be identical to s(max(x),bs="c*"), which may not be matching in the right place). Simon On Tuesday 18 January 2011 12:07, Clare Embling wrote: > Hi, > > I have a variable (current speed direction) which is circular (0=360 > degrees), and I'd like my GLM to include the variable as a circular > variable. Can I do this? And what is the code? > > I'm actually doing a GLM-GEE using the 'geepack' package, so want to use it > in that, but also interested in whether it can also be used in GLMs and > GAMs (I use the 'mgcv' package for GAMs). > > Any help would be gratefully received, > Thanks in advance, > > :o) Clare > > ______________________________________________ > R-help@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 Sciences, University of Bath, Bath, BA2 7AY UK > +44 1225 386603 www.maths.bath.ac.uk/~sw283 ______________________________________________ R-help@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.