
Test a shared candidate against local count-model residuals
Source:R/refitCandidate.R
refitCandidate.RdA measured donor spectrum or a library spectrum proposes a component in one or more sample windows. The fitted mean in window s is O + h p', where O includes the background and every retained component. Each h has contiguous support and is log-concave on that sample's scan grid.
Arguments
- windows
A list of windows, one per sample, each a list with numeric matrices y (nonnegative observations) and offset (current fitted mean, including neighbours), time (strictly increasing coordinates, optional), and dispersion (positive quasi-Poisson dispersion, default one). All windows use the same channels in the same order. Supply disjoint observations across windows. Unit dispersion uses Poisson deviance.
- spectrum
Nonnegative seed, in the same order as the observed channels.
- price
GIC cost per degree of freedom from the parent model.
- update_spectrum
Estimate a sparse shared spectrum from the observations. FALSE conditions on a known external spectrum. When comparing proposals derived from the observations, use TRUE to charge for the estimated spectrum.
- cycles
Maximum number of profile and spectrum sweeps.
- ncores
Thread budget for the spectrum update.
Value
A list with accepted, spectrum (unit sum for an accepted component), profiles (scan totals on input grids), delta_gic relative to the supplied offsets, and trace (accepted objective changes relative to the null). For a rejected candidate all fitted contributions are zero.
Details
The change in criterion is the sum of changes in original-channel scaled Poisson deviance plus price times the profile face dimensions and, for an estimated spectrum, its positive channel count less one. The offset is held fixed. The seed guides optimisation and does not establish chemical identity. The comparison conditions on the proposed windows and on the supplied dispersion and price.