4
$\begingroup$

I am trying to analyse (using R) a set of r(theta) data to see if the magnitude (r) is dependent on direction (theta). I have looked at circular statistics but these only seem to deal with the distribution of the observations theta(i) around the circle.

Our null hypothesis is r=1 for all theta, vs its not.

If H0 is false then we would like to be able to find the principal directions involved. From theoretical considerations we expect r(180)>1 and r(0)<1 with r(90)=r(270)=1

Some way of graphically representing this would be useful.

The data comes from the interaction of water waves and tidal currents with zero degrees representing the waves travelling in the same direction as the current.

$\endgroup$
5
$\begingroup$

This appears to need a combination of exploration and confirmation.

To explore, graph the data. Polar plots work well. This one includes a smoothed version of the data (red line), which were obtained at 49 randomly selected angles:

Polar plot

There is just the slightest hint that the radii may have the alternative pattern: the smooth is just a bit greater than 1 for angles near 0 and just a bit less than 1 for angles near $\pi$. However, the scatter around the smooth is much greater than that, suggesting that this result may be due to chance.

A more powerful method of plotting these data to test this particular alternative is to match data obtained at angles $\theta$ with those obtained near angles $\theta+\pi$. (Although this halves the amount of data available for comparison, its amplification of the expected response more than makes up for that.) According to $H_0$, differences in radii will be scattered around $0$, whereas according to $H_1$, the differences will tend to be negative for small angles, pass through $0$ near $\pi/2$, and become positive. The next figure plots these differences. Specifically, it sorts the 49 observed values of $(\theta,r)$ and plots the 24 pairs $((\theta_{i} + \theta_{i+24} - \pi)/2, (r_{i} - r_{i+24}))$ for $i=1,2,\ldots,24$:

Derived scatterplot

This approach opens the analysis to standard methods (exploratory and confirmatory) to check trends. For instance, we could perform a naive least-squares fit (of a linear trend). The result for these data, $p = 0.038$, might be considered significant evidence in favor of the alternative.

More sophisticated methods worth considering include:

  • For exploration or confirmation, divide data into three groups for angles near $0$, $\pi/2$, and $\pi$. Compare the medians (or means) of differences of $r$ within each group. In this instance, ANOVA (as well as visual examination) indicates there are differences:

Box and whisker charts

  • For confirmation, perform a multivariate least squares fit of the data to a few cosines (of periods $2\pi$ and $\pi$ to start). $H_0$ says that at most the constant term is significant; $H_1$ would be demonstrated by significance of any one of the odd-frequency terms.

  • For exploration or confirmation, fit periodic splines to the data.

Incidentally, these data were generated by the relation $r = 1 + \cos[\theta]^3/10$ with iid Normal error of standard deviation $1/10$ added. The figure shows this curve along with the null hypothesis (a dashed red circle) and the data.

Data with reference curves

$\endgroup$
3
  • $\begingroup$ Have you got code for your circular smoothing you've done in your first plot here? I'm about to ask something on stackoverflow otherwise... $\endgroup$ – Spacedman Nov 16 '12 at 17:40
  • $\begingroup$ @Spaced Unfortunately, I did not save the code (a Mathematica notebook). As I recall, the smoothing was done with a built-in interpolation function, after wrapping the data circularly to assure continuity at the endpoints. For instance, to assure continuity when using a cubic spline, pad the data array (sorted by $\theta$) at the end with the initial $3$ values of $(\theta+2\pi, \rho)$ and at the beginning with the last $3$ values of $(\theta-2\pi, \rho)$. Apply the interpolating function only to $\theta \in [0,2\pi]$. $\endgroup$ – whuber Nov 16 '12 at 18:51
  • $\begingroup$ Yeah, I figured out the padding idea myself shortly after posting this! Might write up an RPub doc sometime... $\endgroup$ – Spacedman Nov 16 '12 at 23:16
1
$\begingroup$

This isn't a perfect solution, but it seems to me that your hypotheses all relate to $\theta$'s distance from 360. So, if you transform your $\theta$ to 360-$\theta$, then you could use 'regular' statistics to examine the hypotheses.

$\endgroup$
1
$\begingroup$

You could resolve the directional measurements into a fore-aft component and a starboard-port set of values. If theta= 0 is the straight into the waves value then take abs(sin(theta)) as the component that is "off-axis" and cos(theta) as the "fore-aft" component.

> theta=seq(0,2*pi, by=pi/2)
> options(digits=4)
> abs(sin(theta))
[1] 0.000e+00 1.000e+00 1.225e-16 1.000e+00 2.449e-16
> abs(cos(theta))
[1] 1.000e+00 6.123e-17 1.000e+00 1.837e-16 1.000e+00

I also think you should spend more time examining the circular package in R. Your data are essentially being measure in polar coordinates, so they are resolvable into magnitude and directional components. It offers regression methods for this type of data which it calls "c-l" (circular-linear).

$\endgroup$

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.