# Statistical tests for distributions on constrained intervals

I have a continuous distribution of angular values on the interval of 0 to 90 degrees. This distribution is expected to follow a half-normal distribution with a greater frequency of values toward zero. I would like to test if the mean (or median) of this distribution is significantly different from the mean (or median) of a uniform random distribution which would have a mean of 45 degrees. However, I am not sure which statistical test is appropriate here given the fixed interval of the angular quantities.

Any help/hints would be greatly appreciated!!

Some more context: The angular values mentioned above are angular differences between some predicted orientation and an observed orientation (sign does not matter). So what I want to test is whether the predicted orientations fit the observed orientations better than a uniform random distribution of orientations.

Edit: Added figure showing distributions • I am having a hard time seeing how these data are circular in any sense. They seem only to be values constrained to lie in the interval $[0,90].$
– whuber
Mar 9, 2021 at 16:49
• @whuber Yes, good point. Physically speaking, they are angular measurements but for the purpose of my problem we can just consider them to be values constrained to the interval [0,90]. Sorry for the misleading title. I'll update it!
– BPV
Mar 9, 2021 at 16:55
• I would characterize the angular distribution using a beta maximum likelihood. A likelihood ratio test can easily test against your null of a uniform, versus a "heaped" distribution, on a constrained support, consistent with a truncated-like normal. Mar 9, 2021 at 17:01
• @AdamO It is difficult to see how a Beta distribution would be sufficiently general or appropriate to model this distribution. Remember, this is a form of folded distribution in which values to the left of zero and the right of zero have been equated. Such distributions don't usually look anything like a Beta distribution.
– whuber
Mar 9, 2021 at 17:09
• @whuber I think you helped me understand the OP's question better: what you're saying is that OP measured absolute deviation from an expected trajectory, and is expecting a distribution headed toward 0 to signify alignment to that expected trajectory versus a totally uniform distribution signifying totally random trajectories? I'd have to agree with you, there's a significant issue of conflating bias versus variance and a test is guaranteed to be impossible to interpret. Mar 9, 2021 at 18:38

A Kolmogorov-Smirnov test will do the job well.

This procedure compares data to a prespecified distribution: in this case, the uniform distribution on the interval $$[0, 90].$$ Its test statistic often called "$$D$$") is the largest vertical deviation between the empirical cumulative distribution function (ecdf) of the data and the cumulative distribution function (cdf) of the reference distribution.

To assess how well this might work, I generated Normal random variates with mean $$25$$ and standard deviation $$28,$$ reduced them modulo $$180$$ degrees to lie between $$-90$$ and $$90$$ (thereby simulating the observed orientation differences), and took their absolute values (to simulate the observed absolute orientation differences). In the plots below, the upper left plot graphs the density function and the bottom left plot is an example of a histogram of a sample of size $$1350$$ -- roughly the same size as displayed in the question. At the bottom right are the ecdf of this sample (black) and the reference cdf (red). An idealization of this plot appears in the upper right, which compares the two cdfs. That plot includes a dashed vertical line marking the location of their greatest vertical departure.

This is such a large sample that the K-S test is virtually guaranteed to discriminate between the two distributions I have used. As an example of what could happen in a more delicate situation, here are the results for a sample of just $$50$$ observations where the standard deviation of the underlying distribution is 1.5 times greater ($$42$$ instead of $$28$$). In 10,000 simulations of this situation, the K-S test found a significant difference (at the usual 95% threshold) only about half the time (54% of them). This estimates the power of the test to detect the difference in this situation.

These tests were carried out using the R ks.test function, as in this line and its output. Its input is the array X of data values shown in histogram of the preceding figure:

ks.test(X, punif, min=0, max=90)

    One-sample Kolmogorov-Smirnov test

data:  X
D = 0.23227, p-value = 0.007441
alternative hypothesis: two-sided