NormalTF {saeHB.twofold} | R Documentation |
This function is implemented to variable of interest y
that assumed to be a Normal Distribution. The range of data is -\infty <y<\infty
This function gives estimation of subarea and area means simultaneously under Twofold Subarea Level Small Area Estimation Model Using Hierarchical Bayesian Method with Normal distribution
NormalTF(
formula,
vardir,
area,
weight,
iter.update = 3,
iter.mcmc = 2000,
thin = 1,
burn.in = 1000,
data,
coef,
var.coef
)
formula |
Formula that describe the fitted model |
vardir |
Sampling variances of direct estimations on each subarea |
area |
Index that describes the code relating to area in each subarea.This should be defined for aggregation to get area estimator. Index start from 1 until m |
weight |
Vector contain proportion units or proportion of population on each subarea. |
iter.update |
Number of updates perform in Gibbs Sampling with default |
iter.mcmc |
Number of total iteration per chain perform in Gibbs Sampling with default |
thin |
Thinning rate perform in Gibbs Sampling and it must be a positive integer with default |
burn.in |
Number of burn in period in Gibbs Sampling with default |
data |
The data frame |
coef |
Vector contains initial value for mean on coefficient's prior distribution or |
var.coef |
Vector contains Initial value for varians on coefficient's prior distribution or |
This function returns a list with following objects:
A dataframe that contains the values, standar deviation, and quantile of Subarea mean Estimates using Twofold Subarea level model under Hierarchical Bayes method
A dataframe that contains the values, standar deviation, and quantile of Area mean Estimates using Twofold Subarea level model under Hierarchical Bayes method
A dataframe that contains estimated subarea and area random effect variance (\sigma_{u}^{2}
and \sigma_{v}^{2})
A dataframe that contains the estimated model coefficient \beta
Trace, Density, Autocorrelation Function Plot of coefficient
##load dataset for data without any nonsampled subarea
data(dataTwofold)
#formula of fitted model
formula=y~x1+x2
#model fitting
mod=NormalTF(formula,vardir="vardir",area="codearea",weight="w",data=dataTwofold)
#estimate
mod$Est_sub #Subarea mean estimate
mod$Est_area #area mean estimate
mod$coefficient #coefficient estimate
mod$refVar #random effect subarea and area estimates
#Load Library 'coda' to execute the plot
#autocorr.plot(mod$plot[[3]]) is used to generate ACF Plot
#plot(mod$plot[[3]]) is used to generate Density and trace plot
##for dataset with nonsampled subarea use dataTwofoldNS