| Title: | Benchmarking Small Area Estimates and Their Mean Squared Errors |
|---|---|
| Description: | Adjusts model-based small area estimates so that their weighted aggregate agrees with the weighted aggregate of the direct estimates, using the difference, ratio, and optimum benchmarking methods described in Rao and Molina (2015, ISBN:978-1-118-73578-7) and Wang, Fuller and Qu (2008). The mean squared error (MSE) of the benchmarked empirical best linear unbiased predictor (EBLUP) under the Fay-Herriot model is estimated with the second-order approximation or the parametric bootstrap of Steorts and Ghosh (2013) <doi:10.5705/ss.2012.053>. The posterior MSE of the benchmarked hierarchical Bayes (HB) estimator follows Datta, Ghosh, Steorts and Maples (2011) <doi:10.1007/s11749-010-0218-y>. |
| Authors: | Fiona Audia Nauli Sihombing [aut, cre, cph], Azka Ubaidillah [aut] |
| Maintainer: | Fiona Audia Nauli Sihombing <fionasihombing95@gmail.com> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-09-28 10:49:43 UTC |
| Source: | https://github.com/fionaaudia/saebenchmarking |
Dataset to simulate benchmarking of small area estimates obtained by the empirical best linear unbiased predictor (EBLUP) under the Fay-Herriot model.
This data is generated based on the Fay-Herriot model by these following steps:
Take the population size pop (in thousands) and the sample
size n of 50 areas from Table 1 of Wang, Fuller and Qu (2008).
Calculate the known sampling variance
and the benchmarking weight
.
Generate the auxiliary variable z ~ N(1, 1) once and keep
it fixed.
Generate the random effect v ~ N(0, 1). Set
= 6 and = 3, then calculate
the true area mean
.
For each area, generate unit observations
with
. Calculate
the direct estimation direct as their mean and the sampling
error as e = direct - theta.
Estimate the random effect variance by restricted maximum
likelihood (REML), then calculate the EBLUP eblup and its mean
squared error mse using sae::mseFH().
Combine all variables in a data frame named data_eblup.
The REML estimate of the random effect variance is stored as the
attribute sigma2_v.
data(data_eblup)data(data_eblup)
A data frame with 50 rows and 12 variables:
Area identifier, 1 to 50
Population size of each area (in thousands)
Sample size of each area
Benchmarking weight, pop / sum(pop)
Auxiliary variable
True random effect
True sampling error
True small area mean
Direct estimation
Known sampling variance, 16 / n
EBLUP estimation
Mean squared error of the EBLUP estimation
The attribute sigma2_v is dropped when the data frame is
subset. Read it first with attr(data_eblup, "sigma2_v").
Molina, I. and Marhuenda, Y. (2015). sae: An R package for small area estimation. The R Journal, 7(1), 81-98.
Wang, J., Fuller, W. A. and Qu, Y. (2008). Small area estimation under a restriction. Survey Methodology, 34(1), 29-36.
You, Y., Rao, J. N. K. and Hidiroglou, M. (2013). On the performance of self benchmarked small area estimators under the Fay-Herriot area level model. Survey Methodology, 39(1), 217-229.
Dataset to simulate benchmarking of small area estimates obtained by the hierarchical Bayes (HB) method under the Fay-Herriot model.
This data is generated based on the Fay-Herriot model by these following steps:
Generate pop, n, weight, z, v,
e, theta, direct, and vardir by steps 1
to 5 of data_eblup. Both datasets share the same values
of these variables.
Set the uniform prior
on the regression coefficients and the random effect variance
, as in Sugasawa, Tamae and Kubokawa (2017), and
treat the sampling variance vardir as known.
Run the Gibbs sampler by updating in turn
from the inverse gamma distribution,
from the bivariate normal distribution, and
from the normal distribution, using their
full conditional distributions.
Discard the first 1,000 iterations as burn-in and keep the next 5,000 draws.
Calculate the HB estimation theta_hb as the mean of the
kept draws and the posterior variance var_hb as their variance.
Combine all variables in a data frame named data_hb.
data(data_hb)data(data_hb)
A data frame with 50 rows and 12 variables:
Area identifier, 1 to 50
Population size of each area (in thousands)
Sample size of each area
Benchmarking weight, pop / sum(pop)
Auxiliary variable
True random effect
True sampling error
True small area mean
Direct estimation
Known sampling variance, 16 / n
HB estimation (posterior mean)
Posterior variance of the HB estimation
Convergence was checked by comparing three chains with different starting values and update orders.
Sugasawa, S., Tamae, H. and Kubokawa, T. (2017). Bayesian estimators for small area models shrinking both means and variances. Scandinavian Journal of Statistics, 44(1), 150-167. doi:10.1111/sjos.12246
Wang, J., Fuller, W. A. and Qu, Y. (2008). Small area estimation under a restriction. Survey Methodology, 34(1), 29-36.
You, Y., Rao, J. N. K. and Hidiroglou, M. (2013). On the performance of self benchmarked small area estimators under the Fay-Herriot area level model. Survey Methodology, 39(1), 217-229.
Computes the mean squared error (MSE) of small area estimates benchmarked
with sae_benchmarking(), for the ratio, difference, or optimum method,
when the original estimates are EBLUPs under the Fay-Herriot model or
hierarchical Bayes (HB) estimates.
mse_benchmarking( object, estimator = c("eblup", "hb"), z = NULL, sigma2_v = NULL, fitting_method = c("REML", "PR"), theta_hb = NULL, V_hb = NULL, posterior_draws = NULL, B = 1000, seed = NULL )mse_benchmarking( object, estimator = c("eblup", "hb"), z = NULL, sigma2_v = NULL, fitting_method = c("REML", "PR"), theta_hb = NULL, V_hb = NULL, posterior_draws = NULL, B = 1000, seed = NULL )
object |
An object of class |
estimator |
Character. |
z |
Design matrix (areas in rows, including the intercept column if
any) used to fit the Fay-Herriot model. Required when
|
sigma2_v |
Estimated random effect variance from the original
Fay-Herriot fit. Required when |
fitting_method |
Character. |
theta_hb |
Numeric vector of HB estimates (posterior means) in the
same order as the areas of |
V_hb |
Numeric vector of HB posterior variances in the same order as
the areas of |
posterior_draws |
Matrix of MCMC draws of the unbenchmarked small
area means (areas in rows, draws in columns). Used when
|
B |
Positive integer. Number of bootstrap replicates, used for the
ratio and optimum methods under |
seed |
Optional integer seed for the bootstrap. The random number generator state of the session is restored on exit. |
A list of class "mse_benchmarking" with elements:
method: the benchmarking method of object.
estimator: "eblup" or "hb".
estimate: named numeric vector of benchmarked estimates.
mse: named numeric vector of estimated MSEs.
B: number of bootstrap replicates requested, or NA when no
bootstrap was used.
n_failed: number of discarded bootstrap replicates, or NA when no
bootstrap was used.
# EBLUP, difference benchmarking (closed form) bm_diff <- sae_benchmarking(method = "difference", direct = "direct", weight = "weight", estimate = "eblup", mse = "mse", vardir = "vardir", data = data_eblup) Z <- cbind(1, data_eblup$z) s2v <- attr(data_eblup, "sigma2_v") res_diff <- mse_benchmarking(bm_diff, estimator = "eblup", z = Z, sigma2_v = s2v, fitting_method = "REML") head(res_diff$mse)# EBLUP, difference benchmarking (closed form) bm_diff <- sae_benchmarking(method = "difference", direct = "direct", weight = "weight", estimate = "eblup", mse = "mse", vardir = "vardir", data = data_eblup) Z <- cbind(1, data_eblup$z) s2v <- attr(data_eblup, "sigma2_v") res_diff <- mse_benchmarking(bm_diff, estimator = "eblup", z = Z, sigma2_v = s2v, fitting_method = "REML") head(res_diff$mse)
Applies difference, ratio, or optimum benchmarking to small area estimates so that their weighted aggregate equals the weighted aggregate of the direct estimates.
sae_benchmarking( method = c("ratio", "difference", "optimum"), direct, weight, estimate, mse = NULL, vardir = NULL, phi_source = c("mse", "vardir"), area_names = NULL, data = NULL )sae_benchmarking( method = c("ratio", "difference", "optimum"), direct, weight, estimate, mse = NULL, vardir = NULL, phi_source = c("mse", "vardir"), area_names = NULL, data = NULL )
method |
Character. One of |
direct |
Numeric vector of direct estimates, or the name of a column
of |
weight |
Numeric vector of non-negative benchmarking weights (e.g.
population proportions), or the name of a column of |
estimate |
Numeric vector of model-based small area estimates (e.g.
EBLUP or HB), or the name of a column of |
mse |
Optional numeric vector of mean squared errors of |
vardir |
Optional numeric vector of sampling variances of |
phi_source |
Character. One of |
area_names |
Optional character vector of area labels. Defaults to
|
data |
Optional data frame. When supplied, |
This function returns a list of class "sae_benchmarking" with elements:
method: the benchmarking method used.
target: numeric value of the target.
estimates: a one-column data frame (Estimate) of benchmarked
estimates, with area names as row names.
params: a list with the adjustment parameter (adjustment, ratio,
or lambda, depending on method).
aggregation: a one-row matrix with columns Direct, Estimate,
Bench, and Target giving the weighted aggregates.
inputs: a list of the inputs used, retained for mse_benchmarking().
mse_benchmarking() to estimate the mean squared error of the
benchmarked estimates.
est <- c(10.2, 8.7, 12.1) direct <- c(10.5, 8.2, 12.8) mse <- c(0.5, 0.4, 0.6) w <- c(0.3, 0.4, 0.3) res <- sae_benchmarking(method = "difference", direct = direct, weight = w, estimate = est, mse = mse) res coef(res) summary(res)est <- c(10.2, 8.7, 12.1) direct <- c(10.5, 8.2, 12.8) mse <- c(0.5, 0.4, 0.6) w <- c(0.3, 0.4, 0.3) res <- sae_benchmarking(method = "difference", direct = direct, weight = w, estimate = est, mse = mse) res coef(res) summary(res)