test Component Count
Tests a component count the analyst proposed against one more than itself.
The instrument the workflow otherwise lacks. fit(numComponents) fits a hypothesised count and countAdequacy says whether a sample of this size could settle one, but nothing says whether these data contradict the count proposed. This does, by building the reference distribution of a quantity the library already computes: twice the gain in log-likelihood from an extra component, reported per count by componentCountEvidence as its marginal gain.
The null is drawn by sampling from the fitted mixture at the hypothesised count and running the same fitting procedure on each sample. See ComponentCountTest for why that, rather than a chi-square, is the only legitimate reference here, and for why the result must not be called a likelihood-ratio test.
Never called automatically. Each replicate is a refit, so a test at the default replicate count costs roughly two hundred times a fit. It is a question the analyst asks, not a stage this class imposes.
Nothing fitted here is returned. The replicate fits exist to be measured and are dropped.
Return
the test, or null when the hypothesised count or the count above it cannot be fitted to this sample at all, in which case the question does not arise
Parameters
the count under test
how many samples to draw from the fitted hypothesised model
the level at which the verdict is read
a factory for the component fitter, fresh per replicate because the fitter is wrapped in a cache keyed by group range, and a cache carried across replicates would answer with another replicate's fits
a factory for the refiner, fresh per replicate for the same reason
a factory for the family selector
the stream to draw replicates with
the stream provider