Package 'saeHB.ME.beta'

Title: SAE with Measurement Error using HB under Beta Distribution
Description: Implementation of Small Area Estimation (SAE) using Hierarchical Bayesian (HB) Method when auxiliary variable measured with error under Beta Distribution. The 'rjags' package is employed to obtain parameter estimates. For the references, see J.N.K & Molina (2015) <doi:10.1002/9781118735855>, Ybarra and Sharon (2008) <doi:10.1093/biomet/asn048>, and Ntzoufras (2009, ISBN-10: 1118210352).
Authors: Azka Ubaidillah [aut], Ratih Rodliyah [aut, cre]
Maintainer: Ratih Rodliyah <[email protected]>
License: GPL-3
Version: 1.1.0
Built: 2024-12-24 06:46:30 UTC
Source: CRAN

Help Index


Sample Data for Small Area Estimation with Measurement Error using Hierarchical Bayesian Method under Beta Distribution

Description

This data generated by simulation based on Hierarchical Bayesian Method under Normal Distribution with Measurement Error by following these steps:

  1. Generate x1x_{1} ~ UNIF(0, 1), x2x_{2} ~ UNIF(0, 1), x3x_{3} ~ UNIF(0, 1), and x4x_{4} ~ UNIF(0, 1)

  2. Generate v.x1v.x_{1} ~ Gamma(2,1) and v.x2v.x_{2} ~ Gamma(2,5)

  3. Generate x1hx_{1h} ~ N(x1x_{1}, sqrt(v.x1v.x_{1})) and x2hx_{2h} ~ N(x2x_{2}, sqrt(v.x2v.x_{2}))

  4. Set Coefficient β0\beta_{0} = β1\beta_{1} = β2\beta_{2} = β3\beta_{3} = β4\beta_{4} = 0,5{0,5}

  5. Generate uu ~ N(0,1) and π\pi ~ Gamma(1,0.5)

  6. Calculate

    μ=β0+β1x1h+β2x2h+β3x3+β4x4+uβ0+β1x1h+β2x2h+β3x3+β4x4+u{\mu} =\frac{\beta_{0} + \beta_{1}*x_{1h} + \beta_{2}*x_{2h} + \beta_{3}*x_{3} + \beta_{4}*x_{4} + u}{\beta0 + \beta1*x1h + \beta2*x2h + \beta3*x3 + \beta4*x4 + u}

  7. Calculate AA = μ\muπ\pi and BB = (1-μ\mu)π\pi

  8. Generate YY ~ UNIF(A,B)

  9. Calculate Mean of Variable Y with

    E(Y)=AA+B{E(Y)}=\frac{A}{A+B}

  10. Calculate Variance of Variable Y with

    Var(Y)=AB(A+B+1)(A+B)2{Var(Y)} = \frac{AB}{ (A+B+1)(A+B)^2}

Direct estimation Y, auxiliary variables x1 x2 x3 x4, sampling variance v, and mean squared error of auxiliary variables v.x1 v.x2 are arranged in a dataframe called dataHBMEbeta.

Usage

data(dataHBMEbeta)

Format

A data frame with 30 rows and 8 variables:

Y

direct estimation of Y.

x1

auxiliary variable of x1.

x2

auxiliary variable of x2.

x3

auxiliary variable of x3.

x4

auxiliary variable of x4.

vardir

sampling variances of Y.

v.x1

mean squared error of x1.

v.x2

mean squared error of x2.


Sample Data for Small Area Estimation with Measurement Error using Hierarchical Bayesian Method under Beta Distribution with Non-sampled Area

Description

This data to simulate Small Area Estimation using Hierarchical Bayesian Method with Measurement Error under Beta Distribution with non-sampled areas

This data contains NA values that indicates no sampled at one or more small areas. It uses the dataHBMEbeta with the direct estimates and the related variances in 5 small areas are missing.

Usage

data(dataHBMEbetaNS)

Format

A data frame with 30 rows and 8 variables:

Y

direct estimation of Y.

x1

auxiliary variable of x1.

x2

auxiliary variable of x2.

x3

auxiliary variable of x3.

x4

auxiliary variable of x4.

vardir

sampling variances of Y.

v.x1

mean squared error of x1.

v.x2

mean squared error of x2.


Small Area Estimation with Measurement Error using Hierarchical Bayesian Method under Beta Distribution

Description

This function is implemented to variable of interest (Y)(Y) that assumed to be a Beta Distribution when auxiliary variable is measured with error. The range of data must be 0<Y<10<Y<1. The data proportion is supposed to be implemented with this function.

Usage

meHBbeta(
  formula,
  var.x,
  coef,
  var.coef,
  iter.update = 3,
  iter.mcmc = 10000,
  thin = 2,
  tau.u = 1,
  burn.in = 2000,
  data
)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The variables included formula must have a length equal to the number of domains m. This formula can provide auxiliary variable either measured with error or combination between measured with error and without error. If the auxiliary variable are combination between error and without error, input the error variable first followed by without error variable.

var.x

vector containing mean squared error of X. The values must be sorted as the X.

coef

a vector contains prior initial value of Coefficient of Regression Model for fixed effect with default vector of 0 with the length of the number of regression coefficients.

var.coef

a vector contains prior initial value of variance of Coefficient of Regression Model with default vector of 1 with the length of the number of regression coefficients.

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.

tau.u

prior initial value of inverse of Variance of area random effect with default 1.

burn.in

burn.in number of iterations to discard at the beginning with default 2000.

data

the data frame.

Value

This function returns a list with 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 data frame with the estimated model coefficient

plot

Trace, Dencity, Autocorrelation Function Plot of MCMC samples

Examples

## it may take time
## Load dataset
data(dataHBMEbeta)

## Auxiliary variables only contains variable with error in aux variable
example <- meHBbeta(Y~x1+x2, var.x = c("v.x1","v.x2"),
                   iter.update = 3, iter.mcmc = 1010,
                   thin = 1, burn.in = 1000, data = dataHBMEbeta)

## you can use dataHBMEbetaNS for using dataset with non-sampled area
## and you can use this function for aux variables contains variable with error and without error

saeHB.ME.beta: Small Area Estimation with Measurement Error using Hierarchical Bayesian Method under Beta Distribution

Description

Implementation of small area estimation using Hierarchical Bayesian (HB) Method when auxiliary variable measured with error under Beta Distribution. The 'rjags' package is employed to obtain parameter estimates.

Authors

Azka Ubaidillah, Ratih Rodliyah

Email

Ratih Rodliyah [email protected]

Functions

meHBbeta

Produces HB estimators, standard error, random effect variance, coefficient and plot under beta distribution.

References

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

Ybarra, L.M. and Lohr, S. L. (2008). Small area estimation when auxiliary information is measured with error. Biometrika 95, 919-931 doi:10.1093/biomet/asn048.

Ntzoufras, I. (2009), Bayesian Modeling Using WinBUGS. 1st Edn., Wiley, New Jersey, ISBN-10: 1118210352.