For a given geography j
, there may be a value pi_j
which is
the ground truth. The analyst has C
cells with estimates of pi_c
that
may be biased. This function, proposed by Ghitza and Gelman
and Ghitza, will find a intercept shift for all C cells to best fit the total
pi`. It is the argmin of the sum of
absolute values of the deviation.
calib_oneway(tgt, ests, n, search = c(-5, 5))
FindDelta function at https://github.com/Catalist-LLC/unemployment/blob/master/unemployment_cps_mrp/helper_functions/GetYHat.R
Also see Evan T. R. Rosenman and Santiago Olivella, "Recalibration of Predictive Models as Approximate Probabilistic Updates" https://arxiv.org/abs/2112.06674
The true target
A vector of current estimate, by cell
The sample size of the estimates, by cell
The lower and upper endpoints of the interval to search
The value of delta or the intercept that minimizes the absolute deviation in total. The value is on the logit scale. To translate to a probability, use invlogit.
calib_twoway