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")
::install.github("Nasyazahira/saeHB.TF.beta") devtools
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
<- betaTF(y~X1+X2, area="codearea", weight="w", data=dataBeta) fit
Extract subarea mean estimation
$Est_sub fit
Extract area mean estimation
$Est_area fit
Extract coefficient estimation \(\beta\)
$coefficient fit
Extract estimation of subarea and area random effect \(u\) and \(v\)
$area_randeff
fit$sub_randeff fit
Extract estimation of subarea and area random effect variance \(\sigma^2_u\) and \(\sigma^2_v\)
$refVar fit
Calculate Relative Standard Error (RSE)
<- (fit$Est_sub$SD)/(fit$Est_sub$Mean)*100
RSE summary(RSE)