Package 'saeHB.twofold'

Title: Hierarchical Bayes Twofold Subarea Level Model SAE
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>.
Authors: Reyhan Saadi [aut, cre], Azka Ubaidillah [aut]
Maintainer: Reyhan Saadi <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-11-29 05:10:07 UTC
Source: https://github.com/reymath99/saehb.twofold

Help Index


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:

  1. Generate sampling error eije_{ij},subarea random effect uiju_{ij}, area random effect viv_{i}, auxiliary variabel xij1,xij2x_{ij1},x_{ij2}, and weight or proportions of unit wijw_{ij}

    • Generate subarea random effect uiju_{ij}~N(0,8)N(0,8)

    • Generate area random effect viv_{i} ~ N(0,8)N(0,8)

    • Generate auxilary variabel on subarea level xij1x_{ij1}~ U(0,1)U(0,1)

    • Generate auxilary variabel on subarea level xij2x_{ij2}~N(10,1)N(10,1)

    • Generate unit proportion on each subarea wijw_{ij}~U(10,20)U(10,20)

    • Generate sampling error eije_{ij}~N(0,σe2)N(0,\sigma^{2}_{e}) where σe2\sigma^{2}_{e}~IG(1,1)IG(1,1) is a variance of direct estimator

    • Setting coefficient β0=β1=β2=1\beta_{0}=\beta_{1}=\beta_{2} =1

    • Calculate target parameter μij=β0+β1xij1+β2xij2+vi+uij\mu_{ij}=\beta_{0} +\beta_{1}x_{ij1} +\beta_{2}x_{ij2}+v_{i}+u_{ij}

    • Calculate direct estimator yij=μij+eijy_{ij}=\mu_{ij}+e_{ij}

  2. Auxiliary variables xij1x_{ij1},xij2x_{ij2}, direct estimation (yijy_{ij}) ,vardir, and weight wijw_{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 yijy_{ij}

x1

Auxiliary variabel of xij1x_{ij1}

x2

Auxiliary variabel of xij2x_{ij2}

codearea

Index that describes the code relating to warea for each subarea

w

Unit proportion on each subarea or weight wijw_{ij}

vardir

Sampling variance of direct estimator yijy_{ij}


Simulated dataset Under Two Fold Subarea level model with Normal distribution and Non-sampled subarea

Description

  1. A dataset to simulate Small Area Estimation using Hierarchical Bayesian method under Two Fold Subarea level model with Normal distribution and Non-sampled subarea

  2. 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 yijy_{ij}

x1

Auxiliary variabel of xij1x_{ij1}

x2

Auxiliary variabel of xij2x_{ij2}

codearea

Index that describes the code relating to area for each subarea

w

Unit proportion on each subarea or weight wijw_{ij}

vardir

Sampling variance of direct estimator yijy_{ij}


Small Area Estimation Using Hierarchical Bayesian Method under Twofold Subarea Level Model with Normal distribution

Description

  • This function is implemented to variable of interest yy that assumed to be a Normal Distribution. The range of data is <y<-\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. wijw_{ij}

iter.update

Number of updates perform in Gibbs Sampling with default 3

iter.mcmc

Number of total iteration per chain perform in Gibbs Sampling with default 2000

thin

Thinning rate perform in Gibbs Sampling and it must be a positive integer with default 1

burn.in

Number of burn in period in Gibbs Sampling with default 1000

data

The data frame

coef

Vector contains initial value for mean on coefficient's prior distribution or β\beta's prior distribution

var.coef

Vector contains Initial value for varians on coefficient's prior distribution or β\beta's prior distribution

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 (σu2(\sigma_{u}^{2} and σv2)\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

##for dataset with nonsampled subarea use dataTwofoldNS

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 [email protected]

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