Discussion:
linear regression for circular-linear data
(too old to reply)
pierre Lenck-Santini
2006-11-01 18:50:42 UTC
Permalink
Hi,
I am having a trouble :
let's say you have circular-linear data (distance of a measure vs
phase of a signal).
How do you establish the relationship between the two variables? I
already computed the circular-linear correlation coefficient (based
on Mardia's work). But I would like to compute the slope of the
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
Scott Seidman
2006-11-01 19:38:03 UTC
Permalink
Post by pierre Lenck-Santini
Hi,
let's say you have circular-linear data (distance of a measure vs
phase of a signal).
How do you establish the relationship between the two variables? I
already computed the circular-linear correlation coefficient (based
on Mardia's work). But I would like to compute the slope of the
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
Title:
Statistical Analysis of Circular Data
ISBN:
0521568900
Publisher:
Cambridge University Press
Author(s):
Nicholas I. Fisher
Format:
Paperback
Publication Date:
Jan 1, 1996
Subject:
Mathematics
Dimensions:
6.81 x 9.72 x .71 in
Pages:
295

Chapter 6 will have everything you want
--
Scott
Reverse name to reply
pierre lenck-santini
2006-11-01 21:26:58 UTC
Permalink
news:ef45058.-1
Statistical Analysis of Circular Data
0521568900
Cambridge University Press
Nicholas I. Fisher
Paperback
Jan 1, 1996
Mathematics
6.81 x 9.72 x .71 in
295
Chapter 6 will have everything you want
--
Scott
Reverse name to reply
That's my bedside book right now but I am a little lost : I need to
know if I can predict my phase based on the distance I measure.
two ways are open to me : either I perform a c-linear association
type analysis (p145). then, in case of a significant association, "
the associated regression model can now be fitted by standard
methods" what does it mean?
I can't use the basic phi = ax+b stuff with cov(x,phi)/var(x) being
the slope, it's circular....

or, based on what is said on the book, I need to perform a
circular-circular correlation (T-linear association)on phase vs
2atan(distance) cf, p 161.
the rho value I get doing fisher is really different from the
linear-circular C-linear association r value I get from p145 (this
one looks appropriate). why is it different? Am I right to use this
method rather than the other? it's too subtile for me.
Then, the regression is pretty hard to implement (I am blond a little
:) I mean I am a neuroscientist, not a statistician).

but thanks, the book is great
Statistical Analysis of Circular Data
0521568900
Cambridge University Press
Nicholas I. Fisher
Paperback
Jan 1, 1996
Mathematics
6.81 x 9.72 x .71 in
295
Chapter 6 will have everything you want
--
Scott
Reverse name to reply
Roger Stafford
2006-11-01 20:26:09 UTC
Permalink
Post by pierre Lenck-Santini
Hi,
let's say you have circular-linear data (distance of a measure vs
phase of a signal).
How do you establish the relationship between the two variables? I
already computed the circular-linear correlation coefficient (based
on Mardia's work). But I would like to compute the slope of the
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
------------------------
It seems to me that, instead of looking for a line of regression, you
should be looking for a plane of regression; that is, a best-fitting plane
for linear data against data restricted to vectors on the unit circle. In
other words, if t is a vector of angular data, 0 to 2*pi, and s is a
corresponding vector of linear data, you would want to choose constants a,
b, and c so as to minimize the quantity

sum((a*cos(t)+b*sin(t)+c-s).^2).

That leads to a standard linear least squares problem using the arrays

A = [mean(cos(t).^2),mean(cos(t).*sin(t)),mean(cos(t)); ...
mean(cos(t).*sin(t)),mean(sin(t).^2),mean(sin(t));
mean(cos(t)),mean(sin(t),1];

u = [mean(cos(t).*s);mean(sin(t).*s);mean(s)];

where you wish to solve A*x = u. Its solution is given by

x = A\u;

The three coefficients will be a = x(1), b = x(2), and c = x(3). Your
best-fitting plane to the s and t data would then have the equation

s2 = a*cos(t) + b*sin(t) + c

Of course, this plane will have a direction of maximum gradient
determined by the coefficients a and b, and a line in the plane along that
direction could be considered a line of regression. However, it requires
some approach such as the above to determine that best direction.

Roger Stafford
Roger Stafford
2006-11-02 10:00:35 UTC
Permalink
In article
Post by Roger Stafford
Post by pierre Lenck-Santini
Hi,
let's say you have circular-linear data (distance of a measure vs
phase of a signal).
How do you establish the relationship between the two variables? I
already computed the circular-linear correlation coefficient (based
on Mardia's work). But I would like to compute the slope of the
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
------------------------
.....
A = [mean(cos(t).^2),mean(cos(t).*sin(t)),mean(cos(t)); ...
mean(cos(t).*sin(t)),mean(sin(t).^2),mean(sin(t));
mean(cos(t)),mean(sin(t),1];
u = [mean(cos(t).*s);mean(sin(t).*s);mean(s)];
where you wish to solve A*x = u. Its solution is given by
x = A\u;
.....
-----------------
Pierre, it would have been better if I had said the following in solving
your (multiple linear regression) least squares problem.

Let the angular and linear data, respectively t and s, be given as
column vectors. Then solve the least squares problem with:

x = [cos(t),sin(t),ones(size(t))]\s;

You should get the same answer as before, but this makes better use of the
matlab backslash operator's abilities. Then, as before, a = x(1), b =
x(2), and c = x(3) will provide the least squares sense best fitting plane
to your data.

If you define t0 = atan2(b,a) and r = sqrt(a^2+b^2), the regression
takes the form

s2 = a*cos(t) + b*sin(t) + c = r*cos(t-t0) + c

and the highest value of predicted s2 will therefore lie in the t0 direction.

Roger Stafford
pierre Lenck-Santini
2006-11-02 17:02:13 UTC
Permalink
Thanks!
this looks like what is said in the book but more detailed!
then I can understand it!
now, do you think, as they say that the direction of the relationship
is really important. I mean, it seems more that x (the distance) is
the independant variable and phi (phase) is what I measure. normally,
the corerlation coefficient is the same if I flip my axes no?
my slope should be what... then?
Post by Roger Stafford
In article
<ellieandrogerxyzzy-***@dialup-4.232.57.133.dial1.losa
n
Post by Roger Stafford
geles1.level3.net>,
Lenck-Santini"
Post by Roger Stafford
Post by pierre Lenck-Santini
Hi,
let's say you have circular-linear data (distance of a
measure
Post by Roger Stafford
vs
Post by Roger Stafford
Post by pierre Lenck-Santini
phase of a signal).
How do you establish the relationship between the two
variables? I
Post by Roger Stafford
Post by pierre Lenck-Santini
already computed the circular-linear correlation
coefficient
Post by Roger Stafford
(based
Post by Roger Stafford
Post by pierre Lenck-Santini
on Mardia's work). But I would like to compute the slope
of the
Post by Roger Stafford
Post by Roger Stafford
Post by pierre Lenck-Santini
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
------------------------
.....
A = [mean(cos(t).^2),mean(cos(t).*sin(t)),mean(cos(t)); ...
mean(cos(t).*sin(t)),mean(sin(t).^2),mean(sin(t));
mean(cos(t)),mean(sin(t),1];
u = [mean(cos(t).*s);mean(sin(t).*s);mean(s)];
where you wish to solve A*x = u. Its solution is given by
x = A\u;
.....
-----------------
Pierre, it would have been better if I had said the following in solving
your (multiple linear regression) least squares problem.
Let the angular and linear data, respectively t and s, be given as
x = [cos(t),sin(t),ones(size(t))]\s;
You should get the same answer as before, but this makes better use of the
matlab backslash operator's abilities. Then, as before, a = x(1),
b =
x(2), and c = x(3) will provide the least squares sense best
fitting plane
to your data.
If you define t0 = atan2(b,a) and r = sqrt(a^2+b^2), the
regression
takes the form
s2 = a*cos(t) + b*sin(t) + c = r*cos(t-t0) + c
and the highest value of predicted s2 will therefore lie in the t0 direction.
Roger Stafford
Roger Stafford
2006-11-02 20:02:05 UTC
Permalink
Post by pierre Lenck-Santini
Thanks!
this looks like what is said in the book but more detailed!
then I can understand it!
now, do you think, as they say that the direction of the relationship
is really important. I mean, it seems more that x (the distance) is
the independant variable and phi (phase) is what I measure. normally,
the corerlation coefficient is the same if I flip my axes no?
my slope should be what... then?
---------------------
That is not how it looks to me, Pierre. Your distance measure, x, (I
called it s2) should be the dependent variable and the angle phi (I called
it t) the independent one. Consider the case when a and b in the best
fitting plane happen to both be zero. Then there is no way you could
consider phi as a function of x when x remains a constant in this best
fit.

As to the importance of the direction I called phi = t0, it determines
the points where your x comes to a maximum and minimum, so I would suppose
that is important in understanding the relationship involved. This would
especially be true if the quantity r = sqrt(a^2+b^2) is large. On the
other hand, if r is small, all phi directions are nearly the same for x.

Roger Stafford
Cato
2009-11-18 23:14:03 UTC
Permalink
Hello,

I am trying to use the regress function in matlab to obtain residuals (i.e. rx) to use in a partial correlation coefficient. The thing is that the two parameters I am correlation are circular data (angle 0 to 360). It seems as if the regress function just gives residuals of linear data...is there a function to find residuals for circular data?

Thank you very much!
Post by Roger Stafford
Post by pierre Lenck-Santini
Thanks!
this looks like what is said in the book but more detailed!
then I can understand it!
now, do you think, as they say that the direction of the relationship
is really important. I mean, it seems more that x (the distance) is
the independant variable and phi (phase) is what I measure. normally,
the corerlation coefficient is the same if I flip my axes no?
my slope should be what... then?
---------------------
That is not how it looks to me, Pierre. Your distance measure, x, (I
called it s2) should be the dependent variable and the angle phi (I called
it t) the independent one. Consider the case when a and b in the best
fitting plane happen to both be zero. Then there is no way you could
consider phi as a function of x when x remains a constant in this best
fit.
As to the importance of the direction I called phi = t0, it determines
the points where your x comes to a maximum and minimum, so I would suppose
that is important in understanding the relationship involved. This would
especially be true if the quantity r = sqrt(a^2+b^2) is large. On the
other hand, if r is small, all phi directions are nearly the same for x.
Roger Stafford
Cato
2009-11-18 23:14:03 UTC
Permalink
Hello,

I am trying to use the regress function in matlab to obtain residuals (i.e. rx) to use in a partial correlation coefficient. The thing is that the two parameters I am correlation are circular data (angle 0 to 360). It seems as if the regress function just gives residuals of linear data...is there a function to find residuals for circular data?

Thank you very much!
Post by Roger Stafford
Post by pierre Lenck-Santini
Thanks!
this looks like what is said in the book but more detailed!
then I can understand it!
now, do you think, as they say that the direction of the relationship
is really important. I mean, it seems more that x (the distance) is
the independant variable and phi (phase) is what I measure. normally,
the corerlation coefficient is the same if I flip my axes no?
my slope should be what... then?
---------------------
That is not how it looks to me, Pierre. Your distance measure, x, (I
called it s2) should be the dependent variable and the angle phi (I called
it t) the independent one. Consider the case when a and b in the best
fitting plane happen to both be zero. Then there is no way you could
consider phi as a function of x when x remains a constant in this best
fit.
As to the importance of the direction I called phi = t0, it determines
the points where your x comes to a maximum and minimum, so I would suppose
that is important in understanding the relationship involved. This would
especially be true if the quantity r = sqrt(a^2+b^2) is large. On the
other hand, if r is small, all phi directions are nearly the same for x.
Roger Stafford
Greg Heath
2006-11-03 10:21:30 UTC
Permalink
Post by pierre Lenck-Santini
Hi,
let's say you have circular-linear data (distance of a measure vs
phase of a signal).
How do you establish the relationship between the two variables? I
already computed the circular-linear correlation coefficient (based
on Mardia's work). But I would like to compute the slope of the
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
In the case of reflections from a stationary radar target at range R,
the transmitted and received signals vary like cos(2*pi*f*(t - t0))
and cos(2*pi*f*(t - t0- 2*R/c)), respectively, where f is the
radar frequency, t is time, t0 a reference time and c the speed of
light.

Typically, R is measured from the receive and transmit time difference

R = c*(Trec -Ttrans) + error1

where the error is too large for precision work. The error can be
reduced by orders of magnitude by using the receive and transmit
signal phase difference and resolving the multiple of 2*pi phase
ambiguity.

This scenario is called "Phase-Derived-Range" and is not a
trivial task.

Your scenario appears to be "Range-Derived-Phase". Is this
correct? If so, what is the application?

Hope this helps.

Greg
Tim howe
2009-08-05 13:14:02 UTC
Permalink
I gather that the original poster is asking how to do a regression where phase is the dependent and position is the independent variable. Given that the poster is a neuroscientist, i would imagine it is to do with the firing phase, with respect to oscillations in the local field potential, of action potentials, possibly correlated to a behaving animal's position. Performing a regression on this kind of relationship is a problem I'm struggling to solve as well.

Roger, would I be correct in assuming that your solution would need to be modified were x to be the independent variable and phi the dependent? If so can you give me any hints as to what I need to be doing?

Thanks

tim

Ps. for clarity, the data set is a series of positions (of an animal moving on a one-dimensional track) , and a corresponding set of phases (of the action potential fired at this position with respect to an EEG rhythm). Each element in the data set represents a single action potential. Clearly there is no meaningful way in which the animal's position can be said to be 'caused' by the phase of the action potential, so phase must be the dependent variable.
Post by Greg Heath
Post by pierre Lenck-Santini
Hi,
let's say you have circular-linear data (distance of a measure vs
phase of a signal).
How do you establish the relationship between the two variables? I
already computed the circular-linear correlation coefficient (based
on Mardia's work). But I would like to compute the slope of the
regression line.
There must be an algorhythm out there
any one knows?
I don't use R but they have this function.
In the case of reflections from a stationary radar target at range R,
the transmitted and received signals vary like cos(2*pi*f*(t - t0))
and cos(2*pi*f*(t - t0- 2*R/c)), respectively, where f is the
radar frequency, t is time, t0 a reference time and c the speed of
light.
Typically, R is measured from the receive and transmit time difference
R = c*(Trec -Ttrans) + error1
where the error is too large for precision work. The error can be
reduced by orders of magnitude by using the receive and transmit
signal phase difference and resolving the multiple of 2*pi phase
ambiguity.
This scenario is called "Phase-Derived-Range" and is not a
trivial task.
Your scenario appears to be "Range-Derived-Phase". Is this
correct? If so, what is the application?
Hope this helps.
Greg
Honi Sanders
2017-11-07 19:46:08 UTC
Permalink
Try Richard Kempter's algorithm for circular-linear correlation.
described in Kempter R, Leibold C, Buzsáki G, Diba K, Schmidt R (2012) Quantifying circular-linear associations: hippocampal phase precession. J Neurosci Methods 207:113–124. http://dx.doi.org/10.1016/j.jneumeth.2012.03.007
Honi Sanders
2017-11-08 20:15:09 UTC
Permalink
Post by Honi Sanders
Try Richard Kempter's algorithm for circular-linear correlation.
described in Kempter R, Leibold C, Buzsáki G, Diba K, Schmidt R (2012) Quantifying circular-linear associations: hippocampal phase precession. J Neurosci Methods 207:113–124. http://dx.doi.org/10.1016/j.jneumeth.2012.03.007
You should also look at Philipp Beren's CircStat toolbox.
1. P. Berens, J. Stat. Softw. 31 (2009). http://kyb.mpg.de/fileadmin/user_upload/files/publications/attachments/J-Stat-Softw-2009-Berens_6037[0].pdf

In particular, I would say that if you are dealing with a circular independent variable and a linear dependent (response) variable, then you want to use circ_corrcl() from CircStat. If you are dealing with a linear independent variable and a circular dependent variable, you want to use cl_corr() from Richard Kempter's implementation.
Loading...