| Type: | Package | 
| Title: | Small Area Estimation using Hierarchical Bayesian Method for Rao Yu Model | 
| Version: | 0.1.1 | 
| Author: | Velia Tri Marliana [aut, cre], Azka Ubaidillah [aut] | 
| Maintainer: | Velia Tri Marliana <221810642@stis.ac.id> | 
| Description: | We designed this package to provide several functions for area level of small area estimation using hierarchical Bayesian (HB) method. This package provides model using panel data for variable interest.This package also provides a dataset produced by a data generation. The 'rjags' package is employed to obtain parameter estimates. Model-based estimators involves the HB estimators which include the mean and the variation of mean. For the reference, see Rao and Molina (2015). | 
| License: | GPL-3 | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| RoxygenNote: | 7.1.2 | 
| URL: | https://github.com/Veliatrimarliana/saeHB.panel | 
| BugReports: | https://github.com/Veliatrimarliana/saeHB.panel/issues | 
| Suggests: | knitr, rmarkdown | 
| VignetteBuilder: | knitr | 
| Imports: | stringr, coda, rjags, stats, grDevices, graphics | 
| SystemRequirements: | JAGS (http://mcmc-jags.sourceforge.net) | 
| Depends: | R (≥ 2.10) | 
| NeedsCompilation: | no | 
| Packaged: | 2022-05-10 00:25:38 UTC; velia | 
| Repository: | CRAN | 
| Date/Publication: | 2022-05-10 12:40:02 UTC | 
Small Area Estimation using Hierarchical Bayesian under Rao-Yu Model with rho=0
Description
This function is implemented to variable of interest ydi
Usage
Panel(
  formula,
  area,
  period,
  vardir,
  iter.update = 3,
  iter.mcmc = 2000,
  thin = 2,
  burn.in = 1000,
  tau.e = 1,
  tau.v = 1,
  data
)
Arguments
| formula | Formula that describe the fitted model | 
| area | Number of areas (domain) of the data | 
| period | Number of periods (subdomains) for each area of the data | 
| vardir | Sampling variances of direct estimations | 
| iter.update | Number of updates with default  | 
| iter.mcmc | Number of total iterations per chain with default  | 
| thin | Thinning rate, must be a positive integer with default  | 
| burn.in | Number of iterations to discard at the beginning with default  | 
| tau.e | Variance of area-by-time effect of variable interest with default  | 
| tau.v | Variance of random area effect of variable interest with default  | 
| data | The data frame | 
Value
This function returns a list of the following objects:
| Est | A vector with the values of Small Area mean Estimates using Hierarchical bayesian method | 
| refVar | Estimated random effect variances | 
| coef | A dataframe with the estimated model coefficient | 
| plot | Trace, Density, Autocorrelation Function Plot of MCMC samples | 
Examples
##For data without any non-sampled area
data(dataPanel)     # Load dataset
formula = ydi ~ xdi1 + xdi2
area = max(dataPanel[, "area"])
period = max(dataPanel[,"period"])
vardir = dataPanel[,"vardir"]
result <- Panel(formula, area, period, vardir, data = dataPanel)
result$Est
result$refVar
result$coef
result$plot
## For data with non-sampled area use dataPanelNs
Small Area Estimation using Hierarchical Bayesian under Rao-Yu Model
Description
This function is implemented to variable of interest ydi
Usage
RaoYuAr1(
  formula,
  area,
  period,
  vardir,
  iter.update = 3,
  iter.mcmc = 2000,
  thin = 2,
  burn.in = 1000,
  tau.e = 1,
  tau.v = 1,
  data
)
Arguments
| formula | Formula that describe the fitted model | 
| area | Number of areas (domain) of the data | 
| period | Number of periods (subdomains) for each area of the data | 
| vardir | Sampling variances of direct estimations | 
| iter.update | Number of updates with default  | 
| iter.mcmc | Number of total iterations per chain with default  | 
| thin | Thinning rate, must be a positive integer with default  | 
| burn.in | Number of iterations to discard at the beginning with default  | 
| tau.e | Variance of area-by-time effect of variable interest with default  | 
| tau.v | Variance of random area effect of variable interest with default  | 
| data | The data frame | 
Value
This function returns a list of the following objects:
| Est | A vector with the values of Small Area mean Estimates using Hierarchical bayesian method | 
| refVar | Estimated random effect variances | 
| coefficient | A dataframe with the estimated model coefficient | 
| alpha | Parameter dispersion of Generalized Poisson distribution | 
| plot | Trace, Density, Autocorrelation Function Plot of MCMC samples | 
Examples
##For data without any non-sampled area
data(dataAr1)     # Load dataset
formula = ydi ~ xdi1 + xdi2
area = max(dataAr1[, "area"])
period = max(dataAr1[,"period"])
vardir = dataAr1[,"vardir"]
result <- RaoYuAr1(formula, area, period, vardir, data = dataAr1)
result$Est
result$refVar
result$coefficient
result$plot
## For data with non-sampled area use dataAr1Ns
Sample Data for Small Area Estimation using Hierarchical Bayesian Method for Rao Yu Model
Description
Dataset to simulate Small Area Estimation using Hierarchical Bayesian Method for Rao Yu Model This data is generated by these following steps:
- Generate random effect area - v, random effect for area i at time point j- u, epsilon- \epsilon, variance of ydi- vardir, sampling error- e, auxiliary- xdi1and- xdi2- Set coefficient - \beta_{0}=\beta_{1}=\beta_{2}=2and- \rho = -0,5
- Generate random effect area - v_{i}~N(0,1)
- Generate auxiliary variable - xdi1_{ij}~U(1,2)
- Generate auxiliary variable - xdi2_{ij}~U(1,3)
- Generate epsilon - \epsilon_{ij}- ~N(0,1)
- Calculate variance of ydi with - vardir_{ij}~IG(10,6)
- Generate sampling error - e_{ij}~N(0,vardir_{ij})
- Calculate random effect for area i at time point j - u_{ij}=\rho*u_{ij-1}+\epsilon_{ij}
- Calculate - \mu_{ij}=\beta_{0}+\beta_{1}xdi1_{ij}+\beta_{2}xdi2_{ij}+v_{i}+u_{ij}+e_{ij}
- Set - area=50and- period=10
 
- Auxiliary variables - xdi1,xdi2, direct estimation- y,- area,- period, and- vardirare combined in a dataframe called- dataAr1
Usage
dataAr1
Format
A data frame with 100 rows and 6 variables::
- ydi
- Direct Estimation of y 
- area
- Area (domain) of the data 
- period
- Period (subdomain) of the data 
- vardir
- Sampling Variance of y 
- xdi1
- Auxiliary variable of xdi1 
- xdi2
- Auxiliary variable of xdi2 
Sample Data for Small Area Estimation using Hierarchical Bayesian Method for Rao Yu Model with Non Sampled Area
Description
- A dataset to simulate Small Area Estimation using Hierarchical Bayesian method for Rao-Yu Model with Non-sampled Area 
- This data contains NA values that indicates no sampled in at least one area. 
Usage
dataAr1Ns
Format
A data frame with 100 row and 6 column:
- ydi
- Direct Estimation of y 
- area
- Area (domain) of the data 
- period
- Period (subdomain) of the data 
- vardir
- Sampling Variance of y 
- xdi1
- Auxiliary variable of xdi1 
- xdi2
- Auxiliary variable of xdi2 
Sample Data for Small Area Estimation using Hierarchical Bayesian Method for Rao Yu Model when rho = 0
Description
Dataset to simulate Small Area Estimation using Hierarchical Bayesian Method for Rao-Yu Model with rho = 0 This data is generated by these following steps:
- Generate random effect area - v, random effect for area i at time point j- u, epsilon- \epsilon, variance of ydi- vardir, sampling error- e, auxiliary- xdi1and- xdi2- Set coefficient - \beta_{0}=\beta_{1}=\beta_{2}=2and- \rho = -0,5
- Generate random effect area - v_{i}~N(0,1)
- Generate auxiliary variable - xdi1_{ij}~U(1,2)
- Generate auxiliary variable - xdi2_{ij}~U(1,3)
- Generate epsilon - \epsilon_{ij}- ~N(0,1)
- Calculate variance of ydi with - vardir_{ij}~IG(10,6)
- Generate sampling error - e_{ij}~N(0,vardir_{ij})
- Calculate - \mu_{ij}=\beta_{0}+\beta_{1}xdi1_{ij}+\beta_{2}xdi2_{ij}+v_{i}+\epsilon_{ij}+e_{ij}
- Set - area=50and- period=10
 
- Auxiliary variables - xdi1,xdi2, direct estimation- y,- area,- period, and- vardirare combined in a dataframe called- dataPanel
Usage
dataPanel
Format
A data frame with 100 rows and 6 variables::
- ydi
- Direct Estimation of y 
- area
- Area (domain) of the data 
- period
- Period (subdomain) of the data 
- vardir
- Sampling Variance of y 
- xdi1
- Auxiliary variable of xdi1 
- xdi2
- Auxiliary variable of xdi2 
Sample Data for Small Area Estimation using Hierarchical Bayesian Method for Rao Yu Model when rho = 0 with Non Sampled Area
Description
- A dataset to simulate Small Area Estimation using Hierarchical Bayesian method for Rao-Yu Model with Non-sampled area 
- This data contains NA values that indicates no sampled in at least one area. 
Usage
dataPanelNs
Format
A data frame with 100 row and 6 column:
- ydi
- Direct Estimation of y 
- area
- Area (domain) of the data 
- period
- Period (subdomain) of the data 
- vardir
- Sampling Variance of y 
- xdi1
- Auxiliary variable of xdi1 
- xdi2
- Auxiliary variable of xdi2