Whether counts respect the CPB's ceiling can be checked, but not in sample:
its likelihood is minus infinity for any count above the bound, so every
feasible fit respects the bound on the data it was fit to. The check is
one-sided: it detects a ceiling that is too low, where held-out counts reach
it, and has no power against one that is too high (a fitted ceiling above a
true bound is never exceeded), nor where counts stay well below the ceiling
(see implied_ceiling()). ceiling_exceedance() takes held-out
observations and reports how many of their counts exceed the largest count
the fitted model allows at their covariates (max_count of
implied_ceiling()); for a two-part model the bound is the count
component's, and a fixed-effects unit seen in training enters at its own
effect (an unseen one at the mean effect), as in score(). A breached ceiling also zeroes the held-out likelihood, which
score() records with its 1e-12 floor.
Arguments
- fit
A
"cpb","cpb_fe","hurdle_cpb", or"zi_cpb"object.- newdata
Held-out observations, including the response.
- weights
Optional frequency weights for the rows of
newdata: a column name ofnewdataor a numeric vector with one value per row.- offset
Optional offset (log scale) of the count for the
newdatarows; by default a fit made with an offset reads it from the same column ofnewdata(seepredict.cpb()).
Value
A one-row data frame with n (held-out rows, weighted), exceed
(rows above the bound, weighted), and share.