| beta_sar | R Documentation |
This function gives small area estimator under Spatial SAR 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.
beta_sar(
formula,
proxmat,
data,
iter.update = 3,
iter.mcmc = 2000,
thin = 1,
burn.in = 1000,
chains = 2,
n.adapt = 1000,
coef = NULL,
var.coef = NULL,
tau.u = 1,
seed = 123,
quiet = FALSE,
plot = TRUE,
keep.fit = FALSE
)
formula |
Formula that describes the fitted model. |
proxmat |
|
data |
The data frame. |
iter.update |
Number of updates performed during Gibbs sampling. Default is |
iter.mcmc |
Total number of MCMC iterations per chain. Default is |
thin |
Thinning rate for MCMC sampling. Must be a positive integer. Default is |
burn.in |
Number of burn-in iterations discarded from each MCMC chain. Default is |
chains |
Number of parallel MCMC chains. Default is |
n.adapt |
Number of iterations used for the adaptation phase in JAGS. Default is |
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.u |
Initial value or shape for the random effect precision. Default is |
seed |
An integer seed for the random number generator to ensure reproducibility. Default is |
quiet |
Logical; if |
plot |
Logical; if |
keep.fit |
Logical; if |
This function returns a list with the following objects:
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.
A dataframe containing the posterior mean estimates, posterior standard deviations, and 95% credible intervals of the area-specific random effects (v).
A dataframe containing the posterior mean estimates, posterior standard deviations, and 95% credible intervals of the area-specific random effect variances (a.var).
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), the spatial autoregressive parameter (\rho), and the global precision parameter (\phi).
# Load dataset and proximity matrix
data(databeta)
data(weight_mat)
# Fit the Spatial Beta-SAR model
result <- beta_sar(
formula = y ~ x1 + x2,
proxmat = weight_mat,
data = databeta
)
# View the estimation results
# 1. Small Area Estimates
result$est
# 2. Estimated area-specific random effects
result$randeff
# 3. Estimated variance of the random effects
result$refvar
# 4. Estimated regression coefficients, spatial, and precision parameters
result$coefficient
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.