  This paper develops a general framework for conducting inference on the rank
of an unknown matrix $\Pi_0$. A defining feature of our setup is the null
hypothesis of the form $\mathrm H_0: \mathrm{rank}(\Pi_0)\le r$. The problem is
of first order importance because the previous literature focuses on $\mathrm
H_0': \mathrm{rank}(\Pi_0)= r$ by implicitly assuming away
$\mathrm{rank}(\Pi_0)<r$, which may lead to invalid rank tests due to
over-rejections. In particular, we show that limiting distributions of test
statistics under $\mathrm H_0'$ may not stochastically dominate those under
$\mathrm{rank}(\Pi_0)<r$. A multiple test on the nulls
$\mathrm{rank}(\Pi_0)=0,\ldots,r$, though valid, may be substantially
conservative. We employ a testing statistic whose limiting distributions under
$\mathrm H_0$ are highly nonstandard due to the inherent irregular natures of
the problem, and then construct bootstrap critical values that deliver size
control and improved power. Since our procedure relies on a tuning parameter, a
two-step procedure is designed to mitigate concerns on this nuisance. We
additionally argue that our setup is also important for estimation. We
illustrate the empirical relevance of our results through testing
identification in linear IV models that allows for clustered data and inference
on sorting dimensions in a two-sided matching model with transferrable utility.
