# (very basic) One-sample test for binary data

I've repeatedly measured a continuous variable and each measure has been assigned a populational percentile range it falls into (percentile ranges were estimated for general population in another study). The exemplary barplot depicts the share of each group in my sample during different time points.

I'd like to test, whether the percentage, that specific range constitutes in certain time point (eg. share of 90-100th percentile in the 6th time point) differs between my group and general population.

The simplest way would be to perform a one-sample t-test (eg. against the mean of 0.1 in case of 90-100th percentile, as 10% of values will fall above 90th percentile in the population). But is there any alternative if my sample gets small? It would be ideal to perform Fisher's exact test, but I have no reference group - I can only assume, that in general population 1/10 samples will fall into that percentile range.

• "would like to test some plausible hypotheses" -- it sounds from that phrasing as if the hypotheses were generated based on the appearance of the data. If that's the case, you have the problem that you can't readily calculate appropriate p-values if you try to apply the test to the same data that generated the hypotheses. The distribution of the usual test statistics would be affected by looking at the data to generate the hypotheses. – Glen_b -Reinstate Monica Mar 11 '14 at 20:05
• It's not clear to me what your plot is showing. How do you get from 0's and 1's (and presumably associated times) to that picture, which seems to be of some distribution of proportions at each time. – Glen_b -Reinstate Monica Mar 11 '14 at 20:06
• This is a good example, I think, of why stacked bar plots can be problematic. – Peter Flom - Reinstate Monica Mar 11 '14 at 20:33
• @Glen_b, I'm aware of this restriction, plausibility was the cause of carrying out the study. I'm sorry for this ambiguity, I've just wanted to point out, that data seems to be consistent with the idea and I just want to test it. I've also edited my question, to be (hopefully) comprehensible. – mjktfw Mar 11 '14 at 21:08
• @PeterFlom, I was hoping that lengend would finally make it clear, but if not - could you provide me with examples of the proper visualization of such data? Here, extreme values are of most interest and the percentiles listed might represent cutoffs for pathology in population. This way I am able to present all cutoffs within one bar. – mjktfw Mar 11 '14 at 21:10

## 1 Answer

Ok, given mjktfw's comment, I think I have at least something of an answer:

1) You say you turned a continuous variable into one of 5 percentile ranges; I would not do this. Categorizing a continuous variable loses information.

2) If you have some really good reason to do this, OK.

3) You say

I'd like to test, whether the percentage, that specific range constitutes in certain time point (eg. share of 90-100th percentile in the 6th time point) differs between my group and general population.

Since you are assuming that 10% of the general population was in 90-100, you could just do a one way chi-square to see if your percentage is substantially different from 10%. E.g. if you had 20 people in the top 10% and 80 in the bottom 90 % you could use R:

chisq.test(x = c(20,80),p = c(.10,.90))


If you wanted a graph of this, a mosaic plot would work well.

Then you give a graph of all 5 percentile categories over a series of time points, presumably to be able to see how the proportion in each category changed over time. Instead, I would make a line plot with 5 lines: One for each category; time would still be on the x-axis (and I'll presume the times were equally spaced); the y axis would be proportion.

If you want to test more complex hypotheses, please state what they are.

• Thank you, your solution adresses my question very well. Categorization has been performed, because percentiles are a common reference in the field. The only thing still bothering me though, is performing chi-square in a small sample, where I would expect to observe <5 observations at one of the variable's levels. – mjktfw Mar 11 '14 at 22:12