Title: | Small Area Estimation with Measurement Error using Hierarchical Bayesian Method |
---|---|
Description: | Implementation of small area estimation using Hierarchical Bayesian (HB) Method when auxiliary variable measured with error. The 'rjags' package is employed to obtain parameter estimates. For the references, see Rao and Molina (2015) <doi:10.1002/9781118735855>, Ybarra and Lohr (2008) <doi:10.1093/biomet/asn048>, and Ntzoufras (2009, ISBN-10: 1118210352). |
Authors: | Azka Ubaidillah [aut], Muhammad Rifqi Mubarak [aut, cre] |
Maintainer: | Muhammad Rifqi Mubarak <[email protected]> |
License: | GPL-3 |
Version: | 1.0.1 |
Built: | 2024-12-13 06:32:23 UTC |
Source: | CRAN |
Implementation of small area estimation using Hierarchical Bayesian (HB) Method when auxiliary variable measured with error. The 'rjags' package is employed to obtain parameter estimates.
Azka Ubaidillah, Muhammad Rifqi Mubarak
Muhammad Rifqi Mubarak [email protected]
meHBNormal
Produces HB estimators, standard error, random effect variance, coefficient and plot under normal distribution.
meHBt
Produces HB estimators, standard error, random effect variance, coefficient and plot under student-t distribution.
Maintainer: Muhammad Rifqi Mubarak [email protected]
Authors:
Azka Ubaidillah [email protected]
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.
This data generated by simulation based on Hierarchical Bayesian Method under Normal Distribution with Measurement Error by following these steps:
Generate ~ UNIF(0, 1),
~ UNIF(1,5),
~ UNIF(10,15), and
~ UNIF(10,20)
Generate ~ Gamma(1,1) and
~ Gamma(2,1)
Generate ~ N(
, sqrt(
)) and
~ N(
, sqrt(
))
Generate ,
,
,
, and
Generate ~ N(0,1) and
~ 1/(Gamma(1,1))
Calculate =
Generate ~ N(
, sqrt(
))
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 dataHBME
.
data(dataHBME)
data(dataHBME)
A data frame with 30 observations on the following 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.
This data generated by simulation based on Hierarchical Bayesian Method under Student-t Distribution with Measurement Error by following these steps:
Generate ~ UNIF(10, 20) and
~ UNIF(30,50)
Generate ~ 1/(Gamma(1,1))
Generate ~ N(
Generate =
=
= 0.5
Generate ~ N(0,1) and
~ Gamma(10,1)
Calculate =
Generate ~ t(
,
)) and
=
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 dataTMEHB
.
data(dataTMEHB)
data(dataTMEHB)
A data frame with 30 observations on the following 8 variables.
Y
direct estimation of Y.
x1
auxiliary variable of x1.
x2
auxiliary variable of x2.
vardir
sampling variances of Y.
v.x1
mean squared error of x1.
This function is implemented to variable of interest that assumed to be a Normal Distribution when auxiliary variable is measured with error.
meHBNormal( formula, vardir, var.x, coef, var.coef, iter.update = 3, iter.mcmc = 10000, thin = 2, tau.u = 1, burn.in = 2000, data )
meHBNormal( formula, vardir, var.x, coef, var.coef, iter.update = 3, iter.mcmc = 10000, thin = 2, tau.u = 1, burn.in = 2000, data )
formula |
an object of class |
vardir |
vector containing the |
var.x |
vector containing mean squared error of |
coef |
a vector contains prior initial value of Coefficient of Regression Model for fixed effect with default vector of |
var.coef |
a vector contains prior initial value of variance of Coefficient of Regression Model with default vector of |
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 |
tau.u |
prior initial value of inverse of Variance of area random effect with default |
burn.in |
number of iterations to discard at the beginning with default |
data |
the data frame. |
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 |
## Load dataset data(dataHBME) ## Auxiliary variables only contains variable with error example <- meHBNormal(Y~x1+x2, vardir = "vardir", var.x = c("v.x1","v.x2"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataHBME) ## Auxiliary variables contains variable with error and without error example_mix <- meHBNormal(Y~x1+x2+x3, vardir = "vardir", var.x = c("v.x1","v.x2"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataHBME) ## Create dataset with nonsampled area dataHBMEns <- dataHBME dataHBMEns[c(1,10,20,30),"Y"] <- NA ## For data with nonsampled area use dataHBMEns
## Load dataset data(dataHBME) ## Auxiliary variables only contains variable with error example <- meHBNormal(Y~x1+x2, vardir = "vardir", var.x = c("v.x1","v.x2"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataHBME) ## Auxiliary variables contains variable with error and without error example_mix <- meHBNormal(Y~x1+x2+x3, vardir = "vardir", var.x = c("v.x1","v.x2"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataHBME) ## Create dataset with nonsampled area dataHBMEns <- dataHBME dataHBMEns[c(1,10,20,30),"Y"] <- NA ## For data with nonsampled area use dataHBMEns
This function is implemented to variable of interest that assumed to be a Normal Distribution when auxiliary variable is measured with error.
meHBt( formula, vardir, var.x, coef, var.coef, iter.update = 3, iter.mcmc = 10000, thin = 2, tau.u = 1, burn.in = 2000, data )
meHBt( formula, vardir, var.x, coef, var.coef, iter.update = 3, iter.mcmc = 10000, thin = 2, tau.u = 1, burn.in = 2000, data )
formula |
an object of class |
vardir |
vector containing the |
var.x |
vector containing mean squared error of |
coef |
a vector contains prior initial value of Coefficient of Regression Model for fixed effect with default vector of |
var.coef |
a vector contains prior initial value of variance of Coefficient of Regression Model with default vector of |
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 |
tau.u |
prior initial value of inverse of Variance of area random effect with default |
burn.in |
number of iterations to discard at the beginning with default |
data |
the data frame. |
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 |
## Load dataset data(dataTMEHB) ## Auxiliary variables only contains variable with error example <- meHBt(Y~x1, vardir = "vardir", var.x = c("v.x1"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataTMEHB) ## Auxiliary variables contains variable with error and without error example_mix <- meHBt(Y~x1+x2, vardir = "vardir", var.x = c("v.x1"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataTMEHB) ## Create dataset with nonsampled area dataTMEHBns <- dataTMEHB dataTMEHBns[c(1,10,20,30),"Y"] <- NA ## For data with nonsampled area use dataTMEHBns
## Load dataset data(dataTMEHB) ## Auxiliary variables only contains variable with error example <- meHBt(Y~x1, vardir = "vardir", var.x = c("v.x1"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataTMEHB) ## Auxiliary variables contains variable with error and without error example_mix <- meHBt(Y~x1+x2, vardir = "vardir", var.x = c("v.x1"), iter.update = 3, iter.mcmc = 10000, thin = 5, burn.in = 1000, data = dataTMEHB) ## Create dataset with nonsampled area dataTMEHBns <- dataTMEHB dataTMEHBns[c(1,10,20,30),"Y"] <- NA ## For data with nonsampled area use dataTMEHBns