[R-sig-ME] Modeling polar coordinates
Titus von der Malsburg
malsburg at gmail.com
Tue Aug 24 17:00:21 CEST 2010
Luca, thanks for these suggestions. Your pointers led me to two
packages that provide regression modeling for circular dependent
variables: CircStat and circular. The latter seems to be the
successor of the former. Unfortunately, these packages don't solve my
problem as they model a circular variable only as a function of one
circular or linear independent variable. The paper that you mention
uses CircStat.
Following the references in the documentation I found some papers by
statisticians that discuss possible solutions for the problem. E.g:
NI Fisher and AJ Lee, Regression Models for an Angular Response.
Biometrics, Vol. 48, No. 3 (Sep., 1992), pp. 665-677.
Unfortunately, my knowledge of the theory of generalized linear models
is insufficient to turn the information in those papers into a
solution. Please forgive me if the following is nonsense: The
proposed solution seems to come down to define an appropriate link
function that maps the linear predictor to the circular dependent
variable. However, as far as I can see, lmer only allows you to
select among a set of predefined link functions, none of which does
what I want, and I don't see how I can plug in custom link functions.
Your suggestion about using sin and cos combinations sounds
interesting, but your description is a bit too terse for me. Could
you please elaborate your idea a little bit? To make sure we're on
the same page: the circular variable is my dependent variable. The
predictors are linear.
Is this roughly what you propose?:
# This is the circular variable ranging from 0 to 2*pi:
x <- rnorm(100, pi, 0.5)
mer.cos <- lmer(cos(x) ~ 1 + factor + (1|subject), my.data.frame)
mer.sin <- lmer(sin(x) ~ 1 + factor + (1|subject), my.data.frame)
This is of course modulo some transformation that makes the residuals
being normally distributed. (Which would that be?)
Many thanks again,
Titus
On Wed, Aug 18, 2010 at 12:16:32PM -0400, Luca Borger wrote:
> unless I'm misunderstanding, isn't this one of those cases were you
> need to use circular regression methods? e.g. for an example:
>
> S. Rao Jammalamadaka and Ulric J. Lund (2006) "The effect of wind
> direction on ozone levels - a case study".
> Environmental and Ecological Statistics 13(3): 287-298
>
> so to analyse a variable like day of the year you need to multiply
> it by 2*pi/365, then you can model it as a combination of sin and
> cos terms of the circualr variable in mixed effects models (please
> check the details for the polar coordinates - I think you can look
> up the examples where wind direction is modeled?).
More information about the R-sig-mixed-models
mailing list