Package 'msaeHB'

Title: Multivariate Small Area Estimation using Hierarchical Bayesian Method
Description: Implements area level of multivariate small area estimation using Hierarchical Bayesian method under Normal and T distribution. The 'rjags' package is employed to obtain parameter estimates. For the reference, see Rao and Molina (2015) <doi:10.1002/9781118735855>.
Authors: Azka Ubaidillah [aut], Novia Permatasari [aut, cre]
Maintainer: Novia Permatasari <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-10-26 06:16:38 UTC
Source: CRAN

Help Index


Sample Data for Small Area Estimation using Hierarchical Bayesian Method under Multivariate Normal distribution

Description

Dataset to simulate Small Area Estimation using Hierarchical Bayesian Method under Multivariate Normal distribution

This data is generated by these following steps:

  1. Generate sampling error e, random effect u, and auxiliary variables X1 X2.

    • For sampling error e, we set ede_{d} ~ N3(0,Ved)N_{3}(0, V_{ed}) , where Ved=(σdij)i,j=1,2,3V_{ed} = (\sigma_{dij})_{i,j=1,2,3}, with σii\sigma_{ii} ~ InvGamma(a,b)InvGamma(a, b) and ρe\rho_{e} = 0.5.

    • For random effect u, we set uu ~ N3(0,Vu)N_{3}(0, V_{u}).

    • For auxiliary variables X1 and X2, we set X1X1 ~ UNIF(1,2)UNIF(1,2) and X2X2 ~ UNIF(1,10)UNIF(1, 10).

  2. Calculate direct estimation Y1 Y2 and Y3 , where YiY_{i} = Xβ+ui+eiX * \beta + u_{i} + e_{i}. We take β1=1\beta_{1} = 1 and β2=1\beta_{2} = 1.

Auxiliary variables X1 X2, direct estimation Y1 Y2 Y3, and sampling variance-covariance v1 v2 v3 v12 v13 v23 are combined into a dataframe called datasaeNorm

Usage

datasaeNorm

Format

A data frame with 30 rows and 11 variables:

X1

Auxiliary variable of X1

X2

Auxiliary variable of X2

Y1

Direct Estimation of Y1

Y2

Direct Estimation of Y2

Y3

Direct Estimation of Y3

v1

Sampling Variance of Y1

v12

Sampling Covariance of Y1 and Y2

v13

Sampling Covariance of Y1 and Y3

v2

Sampling Variance of Y2

v23

Sampling Covariance of Y2 and Y3

v3

Sampling Variance of Y3


Sample Data for Small Area Estimation using Hierarchical Bayesian Method under Multivariate T distribution

Description

Dataset to simulate Small Area Estimation using Hierarchical Bayesian Method under Multivariate T distribution

This data is generated by these following steps:

  1. Generate sampling error e, random effect u, and auxiliary variables X1 X2.

    • For sampling error e, we set ede_{d} is multivariate T distributed where the vector of noncentrality parameters is zero, scale matrix Ved=(σdij)i,j=1,2,3V_{ed} = (\sigma_{dij})_{i,j=1,2,3}, with σii\sigma_{ii} ~ InvGamma(a,b)InvGamma(a, b) and ρe\rho_{e} = 0.5, and degree of freedom dfdf ~ InvGamma(a,b)InvGamma(a, b).

    • For random effect u, we set uu ~ N3(0,Vu)N_{3}(0, V_{u}).

    • For auxiliary variables X1 and X2, we set X1X1 ~ UNIF(1,2)UNIF(1,2) and X2X2 ~ UNIF(1,10)UNIF(1, 10).

  2. Calculate direct estimation Y1 Y2 and Y3 , where YiY_{i} = Xβ+ui+eiX * \beta + u_{i} + e_{i}. We take β1=1\beta_{1} = 1 and β2=1\beta_{2} = 1.

Auxiliary variables X1 X2, direct estimation Y1 Y2 Y3, and sampling variance-covariance v1 v2 v3 v12 v13 v23 are combined into a dataframe called datasaeT

Usage

datasaeT

Format

A data frame with 30 rows and 11 variables:

X1

Auxiliary variable of X1

X2

Auxiliary variable of X2

Y1

Direct Estimation of Y1

Y2

Direct Estimation of Y2

Y3

Direct Estimation of Y3

v1

Sampling Variance of Y1

v12

Sampling Covariance of Y1 and Y2

v13

Sampling Covariance of Y1 and Y3

v2

Sampling Variance of Y2

v23

Sampling Covariance of Y2 and Y3

v3

Sampling Variance of Y3


Transform Dataframe to Matrix R

Description

This function transforms dataframe contains sampling variance to a diagonal matrix R

Usage

df2R(R, r)

Arguments

R

dataframe of sampling variances of direct estimators.

r

number of variables

Value

Block diagonal matrix R

Examples

NULL

Multivariate Small Area Estimation using Hierarchical Bayesian under Normal Distribution

Description

This function implements small area estimation using hierarchical bayesian to variable of interest that assumed to be a multivariate normal distribution.

Usage

mHBNormal(
  formula,
  vardir,
  iter.update = 3,
  iter.mcmc = 10000,
  thin = 2,
  burn.in = 2000,
  data
)

Arguments

formula

an object of class list of formula, describe the model to be fitted

vardir

vector containing name of sampling variances of direct estimators in the following order : var1, var2, . , var(k) , cov12, . cov1k, cov23, . , cov(k-1)(k)

iter.update

number of updates with default 3

iter.mcmc

number of total iterations per chain with default 10000

thin

thinning rate, must be a positive integer with default 2

burn.in

number of iterations to discard at the beginning with default 2000

data

dataframe containing the variables named in formula and vardir

Value

The function returns a list with the following objects:

Est

A vector with the values of Small Area mean Estimates using Hierarchical bayesian method

coefficient

A dataframe with the estimated model coefficient

plot

Trace, Density, Autocorrelation Function Plot of MCMC samples

Examples

## Load dataset
  data(datasaeNorm)
  ## Using parameter 'data'
  Fo <- list(f1=Y1~X1+X2,
             f2=Y2~X1+X2)
  vardir <- c("v1", "v2", "v12")
  m1 <- mHBNormal(formula=Fo, vardir=vardir,
  iter.update = 1, iter.mcmc = 1000,
  thin = 2, burn.in = 200, data=datasaeNorm)

Multivariate Small Area Estimation using Hierarchical Bayesian under T Distribution

Description

This function implements small area estimation using hierarchical bayesian to variable of interest that assumed to be a multivariate T distribution.

Usage

mHBT(
  formula,
  vardir,
  iter.update = 3,
  iter.mcmc = 10000,
  thin = 2,
  burn.in = 2000,
  data
)

Arguments

formula

an object of class list of formula, describe the model to be fitted

vardir

vector containing name of sampling variances of direct estimators in the following order : var1, var2, . , var(k) , cov12, . cov1k, cov23, . , cov(k-1)(k)

iter.update

number of updates with default 3

iter.mcmc

number of total iterations per chain with default 10000

thin

thinning rate, must be a positive integer with default 2

burn.in

number of iterations to discard at the beginning with default 2000

data

dataframe containing the variables named in formula and vardir

Value

The function returns a list with the following objects:

Est

A vector with the values of Small Area mean Estimates using Hierarchical bayesian method

coefficient

A dataframe with the estimated model coefficient

plot

Trace, Density, Autocorrelation Function Plot of MCMC samples

Examples

## Load dataset
  data(datasaeT)
  ## Using parameter 'data'
  Fo <- list(f1=Y1~X1+X2,
             f2=Y2~X1+X2)
  vardir <- c("v1", "v2", "v12")
  m1 <- mHBT(formula=Fo, vardir=vardir,
  iter.update = 1, iter.mcmc = 1000,
  thin = 2, burn.in = 200, data=datasaeT)

msaeHB : Multivariate Small Area Estimation using Hierarchical Bayesian Method

Description

Implements area level of multivariate small area estimation using hierarchical Bayesian (HB) method under Normal and T distribution. The 'rjags' package is employed to obtain parameter estimates. For the reference, see Rao and Molina (2015) <doi:10.1002/9781118735855>.

Author(s)

Azka Ubaidillah [email protected] and Novia Permatasari [email protected]

Maintainer: Novia Permatasari [email protected]

Functions

mHBNormal

Estimate multivariate small area estimation under normal distribution

mHBT

Estimate multivariate small area estimation under normal distribution

Reference

  • Rao, J.N.K & Molina. (2015). Small Area Estimation 2nd Edition. New York: John Wiley and Sons, Inc. <doi:10.1002/9781118735855>.