Type: | Package |
Title: | Hierarchical Bayes Twofold Subarea Level Model SAE |
Version: | 0.1.2 |
Maintainer: | Reyhan Saadi <reyhansaadi335@gmail.com> |
Description: | We designed this package to provides several functions for area and subarea level of small area estimation under Twofold Subarea Level Model using hierarchical Bayesian (HB) method with Univariate Normal distribution for variables of interest. Some dataset simulated by a data generation are also provided. The 'rjags' package is employed to obtain parameter estimates using Gibbs Sampling algorithm. Model-based estimators involves the HB estimators which include the mean, the variation of mean, and the quantile. For the reference, see Rao and Molina (2015) <doi:10.1002/9781118735855>, Torabi and Rao (2014) <doi:10.1016/j.jmva.2014.02.001>, Leyla Mohadjer et al.(2007) http://www.asasrms.org/Proceedings/y2007/Files/JSM2007-000559.pdf, and Erciulescu et al.(2019) <doi:10.1111/rssa.12390>. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
Imports: | rjags, coda, stringr, stats, grDevices, graphics, data.table, utils |
RoxygenNote: | 7.2.3 |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
SystemRequirements: | JAGS (http://mcmc-jags.sourceforge.net) |
VignetteBuilder: | knitr |
URL: | https://github.com/reymath99/saeHB.twofold |
BugReports: | https://github.com/reymath99/saeHB.twofold/issues |
NeedsCompilation: | no |
Packaged: | 2024-11-27 10:39:18 UTC; USER10 |
Author: | Reyhan Saadi [aut, cre], Azka Ubaidillah [aut] |
Repository: | CRAN |
Date/Publication: | 2024-11-28 11:20:03 UTC |
Config/testthat/edition: | 3 |
Small Area Estimation Using Hierarchical Bayesian Method under Twofold Subarea Level Model with Normal distribution
Description
-
This function is implemented to variable of interest
y
that assumed to be a Normal Distribution. The range of data is-\infty <y<\infty
-
This function gives estimation of subarea and area means simultaneously under Twofold Subarea Level Small Area Estimation Model Using Hierarchical Bayesian Method with Normal distribution
Usage
NormalTF(
formula,
vardir,
area,
weight,
iter.update = 3,
iter.mcmc = 2000,
thin = 1,
burn.in = 1000,
data,
coef,
var.coef
)
Arguments
formula |
Formula that describe the fitted model |
vardir |
Sampling variances of direct estimations on each subarea |
area |
Index that describes the code relating to area in each subarea.This should be defined for aggregation to get area estimator. Index start from 1 until m |
weight |
Vector contain proportion units or proportion of population on each subarea. |
iter.update |
Number of updates perform in Gibbs Sampling with default |
iter.mcmc |
Number of total iteration per chain perform in Gibbs Sampling with default |
thin |
Thinning rate perform in Gibbs Sampling and it must be a positive integer with default |
burn.in |
Number of burn in period in Gibbs Sampling with default |
data |
The data frame |
coef |
Vector contains initial value for mean on coefficient's prior distribution or |
var.coef |
Vector contains Initial value for varians on coefficient's prior distribution or |
Value
This function returns a list with following objects:
- Est_sub
A dataframe that contains the values, standar deviation, and quantile of Subarea mean Estimates using Twofold Subarea level model under Hierarchical Bayes method
- Est_area
A dataframe that contains the values, standar deviation, and quantile of Area mean Estimates using Twofold Subarea level model under Hierarchical Bayes method
- refVar
A dataframe that contains estimated subarea and area random effect variance
(\sigma_{u}^{2}
and\sigma_{v}^{2})
- coefficient
A dataframe that contains the estimated model coefficient
\beta
- plot
Trace, Density, Autocorrelation Function Plot of coefficient
Examples
##load dataset for data without any nonsampled subarea
data(dataTwofold)
#formula of fitted model
formula=y~x1+x2
#model fitting
mod=NormalTF(formula,vardir="vardir",area="codearea",weight="w",data=dataTwofold)
#estimate
mod$Est_sub #Subarea mean estimate
mod$Est_area #area mean estimate
mod$coefficient #coefficient estimate
mod$refVar #random effect subarea and area estimates
#Load Library 'coda' to execute the plot
#autocorr.plot(mod$plot[[3]]) is used to generate ACF Plot
#plot(mod$plot[[3]]) is used to generate Density and trace plot
##for dataset with nonsampled subarea use dataTwofoldNS
Simulated dataset Under Two Fold Subarea level model with Normal distribution.
Description
A dataset to simulate Small Area Estimation using Hierarchical Bayesian method under Two Fold Subarea level model with Normal distribution on variabel interest.
This data is generated by these following steps:
Generate sampling error
e_{ij}
,subarea random effectu_{ij}
, area random effectv_{i}
, auxiliary variabelx_{ij1},x_{ij2}
, and weight or proportions of unitw_{ij}
Generate subarea random effect
u_{ij}
~N(0,8)
Generate area random effect
v_{i}
~N(0,8)
Generate auxilary variabel on subarea level
x_{ij1}
~U(0,1)
Generate auxilary variabel on subarea level
x_{ij2}
~N(10,1)
Generate unit proportion on each subarea
w_{ij}
~U(10,20)
Generate sampling error
e_{ij}
~N(0,\sigma^{2}_{e})
where\sigma^{2}_{e}
~IG(1,1)
is a variance of direct estimatorSetting coefficient
\beta_{0}=\beta_{1}=\beta_{2} =1
Calculate target parameter
\mu_{ij}=\beta_{0} +\beta_{1}x_{ij1} +\beta_{2}x_{ij2}+v_{i}+u_{ij}
Calculate direct estimator
y_{ij}=\mu_{ij}+e_{ij}
Auxiliary variables
x_{ij1}
,x_{ij2}
, direct estimation (y_{ij}
) ,vardir, and weightw_{ij}
are combined in a dataframe called dataTwofold
Usage
dataTwofold
Format
A data frame with 90 rows and 6 columns:
- y
Direct estimation of subarea mean
y_{ij}
- x1
Auxiliary variabel of
x_{ij1}
- x2
Auxiliary variabel of
x_{ij2}
- codearea
Index that describes the code relating to warea for each subarea
- w
Unit proportion on each subarea or weight
w_{ij}
- vardir
Sampling variance of direct estimator
y_{ij}
Simulated dataset Under Two Fold Subarea level model with Normal distribution and Non-sampled subarea
Description
A dataset to simulate Small Area Estimation using Hierarchical Bayesian method under Two Fold Subarea level model with Normal distribution and Non-sampled subarea
This data contains NA values that indicates no sampled at one or more Subareas. It uses the
dataTwofold
with the direct estimates and the related variances in 10 subareas are missing.
Usage
dataTwofoldNS
Format
A data frame with 90 rows and 6 columns:
- y
Direct estimation of subarea mean
y_{ij}
- x1
Auxiliary variabel of
x_{ij1}
- x2
Auxiliary variabel of
x_{ij2}
- codearea
Index that describes the code relating to area for each subarea
- w
Unit proportion on each subarea or weight
w_{ij}
- vardir
Sampling variance of direct estimator
y_{ij}
saeHB.twofold : Small Area Estimation Under Twofold Subarea Level Model Using Hierarchical Bayesian Method
Description
Provides several functions for area and subarea level of small area estimation under Twofold Subarea Level Model using hierarchical Bayesian (HB) method with Univariate Normal distribution for variables of interest. Some dataset simulated by a data generation are also provided. The 'rjags' package is employed to obtain parameter estimates using Gibbs Sampling algorithm. Model-based estimators involves the HB estimators which include the mean, the variation of mean, and the quantile. For the reference, see Rao and Molina (2015), Torabi (2014), Leyla Mohadjer et.al(2007)
Author(s)
Reyhan Saadi, Azka Ubaidillah
Maintaner: Reyhan Saadi reyhansaadi335@gmail.com
Functions
NormalTF
This function gives estimation of subarea and area means simultaneously under Twofold Subarea Small Area Estimation Model Using Hierarchical Bayesian Method with Normal distribution based on model in Torabi (2014) amd Erciulescu et al. (2018)
Reference
Mohadjer, L.K., Rao, J.N., Liu, B., Krenzke, T., & Kerckhove, W.V. (2007). Hierarchical Bayes Small Area Estimates of Adult Literacy Using Unmatched Sampling and Linking Models.
Torabi, M., & Rao, J.N. (2014). On small area estimation under a sub-area level model. J. Multivar. Anal., 127, 36-55. DOI:10.1016/j.jmva.2014.02.001
Rao, J.N.K & Molina. (2015). Small Area Estimation 2nd Edition. New York: John Wiley and Sons, Inc. DOI:10.1002/9781118735855
Erciulescu, A.L., Cruze, N.B. and Nandram, B. (2019), Model-based county level crop estimates incorporating auxiliary sources of information. J. R. Stat. Soc. A, 182: 283-303. DOI:10.1111/rssa.12390