saeHB.TF.beta provides several functions for area and
subarea level of small area estimation under Twofold Subarea Level Model
using hierarchical Bayesian (HB) method with Beta distribution for
variables of interest. Some dataset simulated by a data generation are
also provided. The ‘rstan’ package is employed to obtain parameter
estimates using STAN.
You can install the development version of saeHB.TF.beta from GitHub with:
# install.packages("devtools")
devtools::install.github("Nasyazahira/saeHB.TF.beta")Here is a basic example of using the betaTF function to make estimates based on sample data in this package
library(saeHB.TF.beta)
#Load Dataset
data(dataBeta) #for dataset with nonsampled subarea use dataBetaNS
#Fitting model
fit <- betaTF(y~X1+X2, area="codearea", weight="w", data=dataBeta)Extract subarea mean estimation
fit$Est_subExtract area mean estimation
fit$Est_areaExtract coefficient estimation \(\beta\)
fit$coefficientExtract estimation of subarea and area random effect \(u\) and \(v\)
fit$area_randeff
fit$sub_randeffExtract estimation of subarea and area random effect variance \(\sigma^2_u\) and \(\sigma^2_v\)
fit$refVarCalculate Relative Standard Error (RSE)
RSE <- (fit$Est_sub$SD)/(fit$Est_sub$Mean)*100
summary(RSE)