# Hypothesis test for minimum/maximum

I need some kind of hypothesis test (or at least a reasonable rule of thumb) that will enable me to validate if observed minimum and/or maximum is "close enough" to the theoretical minimum/maximum. I have randomly generated values from some bounded, continuous probability distribution and I need to ensure that the pseudo-random generator produced values that reasonably stay within the bounds, how can this be achieved?

• Is your concern about some source of error (is this implementation right/sufficiently accurate), or is it in relation to the possibility getting a sample (or samples) that are by chance far from what you'd usually see? – Glen_b -Reinstate Monica Jun 20 '17 at 1:15
• @Glen_b I was rather thinking about the second thing, but as you wrote it, looking at errors also may answer the similar question. – Tim Jun 20 '17 at 7:59

If you know the density and distribution function, you can use the distributions of the first and last order statistics. If $n$ is the sample size, $f(x)$ is the pdf and $F(x)$ is the distribution function, then the first order statistic (the minimum) has pdf $$f_{1}(x)=nf(x)[1-F(x)]^{n-1}$$ and the $n$th order statistic (the maximum) has pdf $$f_{n}(x)=nf(x)[F(x)]^{n-1}.$$ If $L,U$ are the lower and upper bounds respectively, and $x_{(1)},x_{(n)}$ are the min and max from the sample, then $$P(X_{(1)}\leq x_{(1)})=\int_{L}^{x_{(1)}}f_{1}(x)dx$$ and $$P(X_{(n)}\geq x_{(n)})=\int_{x_{(n)}}^{U}f_{n}(x)dx.$$ You could then base a test of the hypotheses that the theoretical bounds are true on these distributions.