[R] regression methods for circular(?) data.

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Mon Sep 26 17:46:56 CEST 2005

On 26-Sep-05 nwew wrote:
> Dear R-users,
> I have the following data
> x <- runif(300,min=1,max=230)
> y <- x*0.005 + 0.2
> y <- y+rnorm(100,mean=0,sd=0.1)
> y <- y%%1 #  <------- modulo operation
> plot(x,y)
> and would like to recapture the slope (0.005) and intercept(0.2).
> I wonder if there are any clever algorithms to do this. I was
> looking at the function lm.cirucalar. Is this the method to use?
> If, which of the references is best too look at?
> Eryk

Hi Eryk,

If you know the modulus (in your case 1.0) and you get data that
look like the result of your "plot(x,y)", then I wouldn't mess

I would simply do something like

ix <- ix<-(y < 0.9*(x-50)/200)
y1[ix] <- y1[ix]+1.0

(the constants 0.9/200, -50 being chosen to give a good separation
on the graph).

On the other hand, if there are good reasons why this very simple
approach is not suitable, then if we knew what they were a more
helpful reply would be easier to formulate!

Best wishes,

E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05                                       Time: 15:56:48
------------------------------ XFMail ------------------------------

More information about the R-help mailing list