Our rank selection for NMF is based on sequentially performing the following hypothesis test:
$H_0$: the rank of the feature matrix is $k$.
$H_a$: the rank of the feature matrix is at least $k+1$.
After applying the goodness-of-fit test, if $H_0$ is rejected by significance level 'alpha', let $k=k+1$ and repeat the test until the pvalue is greater than 'alpha'. For our hypothesis test, the test statistic is the likelihood rato. 'inisz' different initial values are used to get the maximum likelihood for rank 'k' NMF and rank 'k+1' NMF. We use a deconvolved parametric bootstrap to obtain the null distribution of the test statistic. The bootstrap size is 'sz'.