beta_nonspatial: Small Area Estimation using Hierarchical Bayesian Method...

View source: R/beta_nonspatial.R

beta_nonspatialR Documentation

Small Area Estimation using Hierarchical Bayesian Method under Non-Spatial Beta Model

Description

This function gives small area estimator under Non-Spatial Model. It is implemented to a variable of interest (y) that is assumed to follow a Beta Distribution. The range of data is 0 < y < 1.

Usage

beta_nonspatial(
  formula,
  data,
  iter.update = 3,
  iter.mcmc = 2000,
  thin = 1,
  burn.in = 1000,
  chains = 2,
  n.adapt = 1000,
  coef = NULL,
  var.coef = NULL,
  tau.v = 1,
  seed = 123,
  quiet = FALSE,
  plot = TRUE,
  keep.fit = FALSE
)

Arguments

formula

Formula that describes the fitted model.

data

The data frame.

iter.update

Number of updates performed during Gibbs sampling. Default is 3.

iter.mcmc

Total number of MCMC iterations per chain. Default is 2000.

thin

Thinning rate for MCMC sampling. Must be a positive integer. Default is 1.

burn.in

Number of burn-in iterations discarded from each MCMC chain. Default is 1000.

chains

Number of parallel MCMC chains. Default is 2.

n.adapt

Number of iterations used for the adaptation phase in JAGS. Default is 1000.

coef

Optional vector containing the mean of the prior distribution of the regression model coefficients.

var.coef

Optional vector containing the variances of the prior distribution of the regression model coefficients.

tau.v

Initial value or shape for the random effect precision. Default is 1.

seed

An integer seed for the random number generator to ensure reproducibility. Default is 123.

quiet

Logical; if TRUE, suppresses the JAGS terminal output. Default is FALSE.

plot

Logical; if TRUE, generates MCMC diagnostic trace, autocorrelation, and density plots. Default is TRUE.

keep.fit

Logical; if TRUE, keeps the raw MCMC coda samples object in the output list. Default is FALSE.

Value

This function returns a list with the following objects:

est

A dataframe containing the posterior mean estimates, posterior standard deviations, and 95% credible intervals of the small area means estimated using the Hierarchical Bayesian method.

randeff

A dataframe containing the posterior mean estimates, posterior standard deviations, and 95% credible intervals of the area-specific random effects (v).

refvar

A dataframe containing the posterior mean estimates, posterior standard deviations, and 95% credible intervals of the global random effect variance (\sigma_{v}^{2}).

coefficient

A dataframe containing the posterior mean estimates, posterior standard deviations, 95% credible intervals, Rhat convergence diagnostics, and effective sample sizes (ESS) for the regression coefficients (\beta) and the global precision parameter (\phi).

Examples

# Load dataset
data(databeta)


# Fit the Non-Spatial Beta model
result <- beta_nonspatial(
  formula = y ~ x1 + x2,
  data = databeta
)

# View the estimation results
# 1. Small Area Estimates
result$est
# 2. Estimated area-specific random effects
result$randeff
# 3. Estimated global variance of the random effects
result$refvar
# 4. Estimated regression coefficients and precision parameter
result$coefficient



saeHB.Spatial.Beta documentation built on July 1, 2026, 5:07 p.m.