posthoc_error: Compute absolute deviation

View source: R/calibrate_1way.R

posthoc_errorR Documentation

Compute absolute deviation

Description

Compute absolute deviation

Usage

posthoc_error(delta, xi, ests, n)

Arguments

delta

The parameter of interest

xi

The true target

ests

A vector of current estimate, by cell

n

The sample size of the estimates, by cell

Author(s)

Yair Ghitza and Shiro Kuriwaki

Source

Modified from AbsError in https://github.com/Catalist-LLC/unemployment/blob/master/unemployment_cps_mrp/helper_functions/GetYHat.R

See Also

logit_ghitza calib_oneway

Examples

 biased_ests <- ccesMRPrun:::invlogit(rnorm(n = 100, mean = 1, sd = 1))
 sizes <- rbinom(n = 100, size = 100, prob = 0.1)
 tru <- 0.5

 # one delta
 posthoc_error(delta = 0.1, xi = tru, ests = biased_ests, n = sizes)

 # test multiple deltas
 deltas <- seq(-3, 3, by = 0.1)
 abserr <- purrr::map_dbl(.x = deltas,
         .f = ~posthoc_error(.x, xi = tru, ests= biased_ests, n = sizes))
 plot(deltas, abserr, bty = "n")


kuriwaki/ccesMRPrun documentation built on Sept. 24, 2024, 2:15 a.m.