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

Description Usage Arguments Value Examples

View source: R/spatial.normal.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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 argument for the mean of the prior distribution of the model coefficients

var.coef

Optional argument for the variances of the prior distribution of the model coefficients

data

The data frame

Value

This function returns a list of the following objects:

Est

A data frame with the 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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

arinams/spatial documentation built on Feb. 14, 2022, 12:44 a.m.