# What is the relationship between quantile functions and p-values

Assume I have a quantile function for an arbitrary probability distribution for random variable x.

Would the x-value corresponding to the 99th percentile be the same as the x-value corresponding to a p-value of 0.01 (one-sided test, right tail)?

Details for my specific problem: I have fitted a gamma distribution to some experimental data and I am trying to calculate p-values (one-sided) for extreme observations in the right tail of the distribution. Since I have learned model parameters for the gamma distribution, I was hoping that I could use qgamma in R to calculate cutoffs for a given p-value significance threshold. Is this a sane thing to do?

-
What exactly are you trying to test and against what alternate hypothesis? –  Jonathan Kariv Jun 29 '10 at 16:13
I have a sample distribution (to which I fit the gamma distribution) that corresponds to lengths of sequences identified at random (the random variable x is the length of sequence). In my case, longer sequences are highly unlikely to occur randomly, and I am trying to calculate p-values for these long sequences (which in my case appear in the far right tail of the sample distribution). The null hypothesis is that a given sequence was identified by chance, the alternative hypothesis is that the sequence was generated by a different, non-random process. –  awesomo Jun 29 '10 at 17:24
Assigning a separate p-value to each future observation is a bit strange. Maybe it would make sense if one has a separate null hypothesis for each of them. However.... are you assuming the distribution of each of those is the fitted distribution? That would not take into account uncertainty resulting from the fact that it's fitted based on a finite sample. That's the sort of thing one does when one uses a t-distribution rather than a normal distribution when sampling from a population that is assumed to be normally distributed. –  Michael Hardy Jun 30 '10 at 2:57

First I'll address your initial question without taking into account the details of the specific problem. The answer is "yes" if, and only if, the probability distribution is that of a test statistic, where the null hypothesis will be rejected if the test statistic is too big.

When you get into the details of your specific problem you become unclear. When you say "fitted a gamma distribution to some experimental data", it sounds as if you've got a sample and you're estimating the two parameters. Maybe some of the data points will fall above the 99th percentile. If 1% of them do so, that doesn't sound like a reason to reject any null hypothesis that I can think of. If a substantial proportion of them do so, I'd wonder about your method of fitting. If you have a null hypothesis that says something about the values of the parameters, then there's the question of what you're going to use as a test statistic, and then there's the question of what is the probability distribution of that test statistic if the null hypothesis is true. You haven't told us enough about your specific problem to make any guesses about those things.

-
Thanks for your answer. To clarify, I have two types of data points: points that I know to be generated from a random process (this is the sample distribution to which I fit the gamma distribution) and test points for which I do not know the generating process (random or non-random). I'm trying to assign p-values to the test points. –  awesomo Jun 29 '10 at 18:51