Generalized Entropy Calibration produces calibration weights based on generalized entropy as the objective function for optimization. In GECcal, design weights play a role in the constraints to ensure design consistency, rather than being part of the objective function.
Paper: Kwon, Y., Kim, J., & Qiu, Y. (2024). Debiased calibration estimation using generalized entropy in survey sampling. Submitted.
GECal is now available in CRAN. Use install.packages for installation.
install.packages("GECal")
The latest version of GECal can instead be installed using the package devtools.
install.packages("devtools") # Install "devtools" if it is unavailable.
::install_github("yonghyun-K/GECal", dependencies = T) devtools
library(GECal)
set.seed(11)
= 10000
N = data.frame(x1 = rnorm(N, 2, 1), x2= runif(N, 0, 4))
x = pt((-x[,1] / 2 - x[,2] / 2), 3);
pi = ifelse(pi >.7, .7, pi)
pi
= rbinom(N, 1, pi)
delta = (delta == 1)
Index_S = pi[Index_S]; d_S = 1 / pi_S
pi_S = x[Index_S,,drop = FALSE]
x_S # pimat = diag(d_S^2 - d_S) / N^2 # 1 / pi_i * (1 - 1 / pi_i)
= rnorm(N, 0, 1)
e = x[,1] + x[,2] + e;
y = y[Index_S] # plot(x_S, y_S)
y_S
# Hajek estimator for population mean
<- GECal::GEcalib(~ 1, dweight = d_S, data = x_S,
calibration0 const = 1, entropy = "SL", method = "DS")
::estimate(y_S ~ 1, calibration = calibration0)$estimate
GECal# sum(y_S * d_S) / sum(d_S)
# Hajek estimator for population total
<- GECal::GEcalib(~ 1, dweight = d_S, data = x_S,
calibration0 const = N, entropy = "SL", method = "DS")
::estimate(y_S ~ 1, calibration = calibration0)$estimate
GECal# sum(y_S * d_S) * N / sum(d_S)
# HT estimator for population total
<- GECal::GEcalib(~ 0, dweight = d_S, data = x_S,
calibration const = numeric(0), entropy = "SL", method = "DS")
::estimate(y_S ~ 1, calibration = calibration)$estimate
GECal
# DS estimator using ET(exponential tilting) divergence
<- GECal::GEcalib(~ ., dweight = d_S, data = x_S,
calibration1 const = colSums(cbind(1, x)), entropy = "ET", method = "DS")
::estimate(y_S ~ 1, calibration = calibration1)$estimate
GECal
# GEC0 estimator using ET entropy
<- GECal::GEcalib(~ ., dweight = d_S, data = x_S,
calibration2 const = colSums(cbind(1, x)),entropy = "ET", method = "GEC0")
::estimate(y_S ~ 1, calibration = calibration2)$estimate
GECal
# GEC estimator using ET entropy
# when the population total for log(d_S) is known.
<- GECal::GEcalib(~ . + g(d_S), dweight = d_S, data = x_S,
calibration3 const = colSums(cbind(1, x, log(1 / pi))),
entropy = "ET", method = "GEC")
::estimate(y_S ~ 1, calibration = calibration3)$estimate
GECal
# GEC estimator using ET entropy
# when the population total for log(d_S) is unknown.
<- GECal::GEcalib(~ . + g(d_S), dweight = d_S, data = x_S,
calibration4 const = colSums(cbind(1, x, NA)),
entropy = "ET", method = "GEC")
::estimate(y_S ~ 1, calibration = calibration4)$estimate
GECal
# GEC estimator using ET entropy using different K_alpha
# when the population total for log(d_S) is unknown.
<- GECal::GEcalib(~ . + g(d_S), dweight = d_S, data = x_S,
calibration5 const = colSums(cbind(1, x, NA)),
entropy = "ET", method = "GEC", K_alpha = "log")
::estimate(y_S ~ 1, calibration = calibration5)$estimate GECal
– CRAN Task View: Official Statistics & Survey Statistics: 4.1 Weighting and Calibration