  This paper investigates the issue of determining the dimensions of row and
column factor spaces in matrix-valued data. Exploiting the eigen-gap in the
spectrum of sample second moment matrices of the data, we propose a family of
randomised tests to check whether a one-way or two-way factor structure exists
or not. Our tests do not require any arbitrary thresholding on the eigenvalues,
and can be applied with no restrictions on the relative rate of divergence of
the cross-sections to the sample sizes as they pass to infinity. Although tests
are based on a randomization which does not vanish asymptotically, we propose a
de-randomized, strong (based on the Law of the Iterated Logarithm) decision
rule to choose in favor or against the presence of common factors. We use the
proposed tests and decision rule in two ways. We further cast our individual
tests in a sequential procedure whose output is an estimate of the number of
common factors. Our tests are built on two variants of the sample second moment
matrix of the data: one based on a row (or column) flattened version of the
matrix-valued sequence, and one based on a projection-based method. Our
simulations show that both procedures work well in large samples and, in small
samples, the one based on the projection method delivers a superior performance
compared to existing methods in virtually all cases considered.
