spatial.normal: Small Area Estimation under Spatial SAR Model and Normal...

View source: R/spatial.normal.R

spatial.normalR Documentation

Small Area Estimation under Spatial SAR Model and Normal Distribution using Hierarchical Bayesian Method

Description

This function gives small area estimator under Spatial SAR Model and is implemented to variable of interest (y) that assumed to be a Normal Distribution. The range of data is (-∞ < y < ∞).

Usage

spatial.normal(
  formula,
  vardir,
  proxmat,
  iter.update = 3,
  iter.mcmc = 2000,
  thin = 1,
  burn.in = 1000,
  coef,
  var.coef,
  data
)

Arguments

formula

formula that describe the fitted model.

vardir

sampling variances of direct estimations.

proxmat

D*D proximity matrix with values in the interval [0,1] containing the proximities between the row and column domains. The rows add up to 1.

iter.update

number of updates with default 3.

iter.mcmc

number of total iterations per chain with default 2000.

thin

thinning rate, must be a positive integer with default 1.

burn.in

number of iterations to discard at the beginning with default 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.

data

the data frame.

Value

This function returns a list of the following objects:

Est

A data frame of Small Area mean Estimates using Hierarchical Bayesian Method

refVar

Estimated random effect variances

coefficient

A data frame with estimated model coefficient

plot

Trace, Density, and Autocorrelation Function Plot of MCMC samples

Examples

## For data without any non-sampled area
data(sp.norm)       # Load dataset
data(prox.mat)      # Load proximity Matrix

result <- spatial.normal(y ~ x1 + x2, "vardir", prox.mat, data = sp.norm)

result$Est          # Small Area mean Estimates
result$refVar       # Estimated random effect variances
result$coefficient  # Estimated model coefficient


# Load library 'coda' to execute the plot
# autocorr.plot(result$plot[[3]])    # Generate ACF Plot
# plot(result$plot[[3]])             # Generate Density and Trace plot



## For data with non-sampled area use sp.normNs



saeHB.spatial documentation built on March 18, 2022, 7:35 p.m.