I have two circular variables and I want to see if they're correlated.
The data comes from a hierarchical and unbalanced experimental design: each participant provided multiple responses and there's many missing data points.
Participants had to point to some distant place in a city. This variable has been transformed to range from -179.9 to +180 so that "0" always means correct pointing to a destination and 180 means pointing in the opposite direction. -10 would mean pointing 10 degrees to the left, etc.
The predictor is the angle of the street they were standing at during this pointing. It has been transformed in the same way, so "0" means that the street was heading exactly towards the destination; -90 would mean that the street was heading 90 degrees to the left relative to the destination, etc. There is only a limited number of streets, so this circular predictor is not evenly spread across the whole -179.9 - +180 scale. Many people were pointing from the same street, so the data is clustered. Also, some streets have many more pointings than others.
I understand that I need a hierarchical (multilevel) circular-circular regression. Here is what I have tried so far (in R) and why it doesn't do the job:
circular
package fits a circular-circular regression but cannot do a hierarchal regression (it doesn't support random effects).circGLMbayes
supports circular outcome but only linear or categorical predictors; doesn't support random effects.brms
supports random effects and a "von_mises" family for circular output but as I understand this is equivalent to a circular-linear regression (not circular-circular).
My questions are:
Are there other software solutions for hierarchical circular-circular regression?
Is there a way to transform the predictor term (e.g. in
brms
) so that it respects the circular nature of this data? I suppose the key problem is that the scale is wrapped, i.e., -179 is in fact very close to +179. Can this be manually accounted for in the model formula?Since the data is clustered within-streets, I'm wondering if I can code streets as a categorical predictor (ordered or discrete). But I don't know how I would then test a hypothesis that two variables are correlated in some systematic way: an ordered factor would mean that there is a continuous relation but is there a way to make the order of factors wrapped?
Additionally, I want to test an interaction with a third variable (i.e., is the correlation stronger for one condition compared to another). But I suppose it will be the "easy" bit once I have a hierarchical circular-circular model implemented.
Of course I'm also open to using other packages, so will appreciate any hints! Thanks.