3
$\begingroup$

I have some data where I want to see if the magnitude of an effect depends on the direction. (Analogous to asking if wind speed depends on wind direction, for example.) In the circular package there is lm.circular which allows doing regression using circular data. However, it only allows the independent variable to be 'linear' (i.e. non-circular), while what I need is the dependent variable to be linear.

I've seen one answer on Cross Validated that basically suggests to look at some cardinal directions. This could work - or I could use some bootstrapping / confidence intervals approach, but I was wondering if there is an existing test for this type of problem.

$\endgroup$
3
  • $\begingroup$ Your dependent variable is linear, while independent variables are circular? $\endgroup$ – user31264 Oct 25 '14 at 20:47
  • $\begingroup$ Yes. I started to write a detailed description, but it just distracts from the question. In the end I measure the dependent variable in four different ways (that I want to compare). There is one direction where the largest effects should be found, but it might be shifted a bit in one direction in two of the methods and in the other direction in the other two. That should be tested. What I can't see is if the effect seems to fall of more or less quickly when measured in the different methods, but perhaps I should look at that too. $\endgroup$ – Marius Oct 26 '14 at 21:15
  • $\begingroup$ It's possible that the discussion in this post (but presumably only with a single cycle, and possibly with several of the higher harmonics described there) might be of some help for your problem. $\endgroup$ – Glen_b Oct 27 '14 at 3:55
3
$\begingroup$

Here, we want to predict a linear dependent variable from circular independent variables. There are several ways to approach this. The main thing to check is whether the relation between your dependent variable (let's say $Y$) and the circular predictor (say $\theta$) has a sinusoidal shape. This is often the case, but not necessarily. Below is an example of data of this shape.

th  <- rnorm(100, 1, 4) %% (2*pi)
err <- rnorm(100, mean = 0, sd = 0.8)
icp <- 10

bc <- 2
bs <- 3

y   <- icp + bc * cos(th) + bs * sin(th) + err

plot(th, y)

Sinusoidal relationship between $\theta$ and $Y$.

If the data does have this shape, roughly, a good simple model for the data is then given by splitting the circular predictor $\theta$ up in a sine and a cosine component, and running a regular linear regression on these two components, in this case by:

lm(y ~ cos(th) + sin(th))

>Call:
>lm(formula = y ~ cos(th) + sin(th))
>
>Coefficients:
>(Intercept)      cos(th)      sin(th)  
>      10.12         2.04         2.95 

Of course, this can be done for multiple predictors as well. A good introduction on this may be found in Pewsey, Neuhauser & Ruxton (2013), Circular Statistics in R.

As mentioned before, we may add terms as in a Fourier regression, but this can only be recommended if the relationship structurally exhibits very different forms, because higher-order Fourier regression introduces, IIRC, a large number of difficult to interpret parameters.

$\endgroup$
1
$\begingroup$

According to the title of your question, you want the linear regression. There is no linear function from circular argument (except the function $ f(x)=0 $ ). Therefore, you should use non-linear functions. I recommend to replace each circular variables $x$ by two variables $\sin x $ and $\cos x$ and use both for linear regression.

$\endgroup$
1
  • 1
    $\begingroup$ I agree. This problem should yield to a centuries-old method known variously as Fourier, trigonometric or periodic regression. But you may need more than one pair of sine and cosine terms. $\endgroup$ – Nick Cox Oct 26 '14 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.