I have supervised learning problem where targets are angles. If I would do simple regression then numbers 360 and 1 would be far away for my model, but actually they are close and predicting x and y coordinates doesn't feels right, since I am trying to predict just one number here. What is the proper way of doing such a problem?

blue dots represent targets

  • $\begingroup$ I am not sure to understand your problem. Have you an angular variable, say $\theta_i$ and some linear predictor $z_i$? or also your predictor are angular? or what? $\endgroup$
    – niandra82
    Jul 30, 2014 at 14:35
  • $\begingroup$ Only targets are angular (as shown on the picture), predictors are numeric. $\endgroup$
    – rep_ho
    Jul 30, 2014 at 14:45
  • 4
    $\begingroup$ See e.g. Pewsey et al. (2013), Circular Statistics in R & the R package circular. $\endgroup$ Jul 30, 2014 at 14:52

1 Answer 1


I suggest you to take a look at the book "Topics in circular statistics" of Jammalamadaka if you are interested in circular variable.

Suppose that your data come from a circular distribution $F()$, and you want to model the (circular) mean of the circular variable: what is generally used is: $$ E(\theta) = 2\arctan(\boldsymbol{\beta}\mathbf{z}_i) $$ $\theta$ is the circular variable, $\boldsymbol{\beta}$ is the vector of regression coefficients and $\mathbf{z}_i$ are the linear covariates.

If you want a parallelism with the usual linear regression you can assume that $\theta_i \sim WN(\mu_i,\sigma^2)$, where $WN()$ indicates the wrapped normal distribution that is in some sense the Normal distribution on a circle. Then

$$ \mu_i = 2\arctan(\boldsymbol{\beta}\mathbf{z}_i) $$ or equivalently

$$ \theta_i = 2\arctan(\boldsymbol{\beta}\mathbf{z}_i) + \epsilon_i $$ where $\epsilon_i \sim WN(0, \sigma^2)$

This type of regression is implemented in the package $circular$ that the user Scortchi suggests

  • $\begingroup$ Thank you, I still don't get some things. Is it possible to use linear regression and just transform angles to something (sines,cosines)? Or the whole regression should "build" differently? I don't want to do it in R, because I have all my other processing steps in python, that's why I am asking. $\endgroup$
    – rep_ho
    Jul 31, 2014 at 8:58
  • $\begingroup$ Angles have no magnitude, if you transform it in something like sine, cosine or something similar, you introduce magnitude.. $\endgroup$
    – niandra82
    Jul 31, 2014 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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