Type: | Package |
Title: | Multivariate Small Area Estimation using Hierarchical Bayesian Method |
Version: | 0.1.0 |
Author: | Azka Ubaidillah [aut], Novia Permatasari [aut, cre] |
Maintainer: | Novia Permatasari <novia.permatasari@bps.go.id> |
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>. |
License: | GPL-3 |
Imports: | rjags,coda |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.2 |
Depends: | R (≥ 2.10) |
NeedsCompilation: | no |
Packaged: | 2022-03-09 18:07:07 UTC; Novia |
Repository: | CRAN |
Date/Publication: | 2022-03-11 09:50:05 UTC |
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:
Generate sampling error
e
, random effectu
, and auxiliary variablesX1 X2
.For sampling error
e
, we sete_{d}
~N_{3}(0, V_{ed})
, whereV_{ed} = (\sigma_{dij})_{i,j=1,2,3}
, with\sigma_{ii}
~InvGamma(a, b)
and\rho_{e}
= 0.5.For random effect
u
, we setu
~N_{3}(0, V_{u})
.For auxiliary variables
X1 and X2
, we setX1
~UNIF(1,2)
andX2
~UNIF(1, 10)
.
Calculate direct estimation
Y1 Y2 and Y3
, whereY_{i}
=X * \beta + u_{i} + e_{i}
. We take\beta_{1} = 1
and\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:
Generate sampling error
e
, random effectu
, and auxiliary variablesX1 X2
.For sampling error
e
, we sete_{d}
is multivariate T distributed where the vector of noncentrality parameters is zero, scale matrixV_{ed} = (\sigma_{dij})_{i,j=1,2,3}
, with\sigma_{ii}
~InvGamma(a, b)
and\rho_{e}
= 0.5, and degree of freedomdf
~InvGamma(a, b)
.For random effect
u
, we setu
~N_{3}(0, V_{u})
.For auxiliary variables
X1 and X2
, we setX1
~UNIF(1,2)
andX2
~UNIF(1, 10)
.
Calculate direct estimation
Y1 Y2 and Y3
, whereY_{i}
=X * \beta + u_{i} + e_{i}
. We take\beta_{1} = 1
and\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 : |
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 |
data |
dataframe containing the variables named in |
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 : |
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 |
data |
dataframe containing the variables named in |
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 azka@stis.ac.id and Novia Permatasari novia.permatasari@bps.go.id
Maintainer: Novia Permatasari novia.permatasari@bps.go.id
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>.