View source: R/spatial.normal.R
spatial.normal | R Documentation |
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 < ∞).
spatial.normal( formula, vardir, proxmat, iter.update = 3, iter.mcmc = 2000, thin = 1, burn.in = 1000, coef, var.coef, data )
formula |
formula that describe the fitted model. |
vardir |
sampling variances of direct estimations. |
proxmat |
|
iter.update |
number of updates with default |
iter.mcmc |
number of total iterations per chain with default |
thin |
thinning rate, must be a positive integer with default |
burn.in |
number of iterations to discard at the beginning with default |
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. |
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 |
## 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.