View source: R/calibrate_1way.R
calib_oneway | R Documentation |
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))
tgt |
The true target |
ests |
A vector of current estimate, by cell |
n |
The sample size of the estimates, by cell |
search |
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.
Yair Ghitza
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
calib_twoway
biased_ests <- ccesMRPrun:::invlogit(rnorm(n = 100, mean = 1, sd = 1))
sizes <- rbinom(n = 100, size = 100, prob = 0.1)
tru <- 0.5
calib_oneway(tgt = tru, ests = biased_ests, n = sizes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.