hb_unit {saeHB.unit} | R Documentation |
Basic Unit Level Model (Battese-Harter-Fuller model) using Hierarchical Bayesian Approach
Description
This function gives the Hierarchical Bayesian (HB) based on a basic unit level model (Battese-Harter-Fuller model).
Usage
hb_unit(
formula,
data_unit,
data_area,
domain,
iter.update = 3,
iter.mcmc = 10000,
coef,
var.coef,
thin = 3,
burn.in = 2000,
tau.u = 1,
seed = 1,
quiet = TRUE,
plot = TRUE
)
Arguments
formula |
an object of class formula that contains a description of the model to be fitted. The variables included in the formula must be contained in the data. |
data_unit |
data frame containing the variables named in |
data_area |
data frame containing the variables named in |
domain |
Character or formula for domain column names in unit data |
iter.update |
Number of updates with default 3 |
iter.mcmc |
Number of total iterations per chain with default 10000 |
coef |
a vector contains prior initial value of Coefficient of Regression Model for fixed effect with default vector of 0 with the length of the number of regression coefficients |
var.coef |
a vector contains prior initial value of variance of Coefficient of Regression Model with default vector of 1 with the length of the number of regression coefficients |
thin |
Thinning rate, must be a positive integer with default 2 |
burn.in |
Number of iterations to discard at the beginning with default 2000 |
tau.u |
Prior initial value of inverse of Variance of area random effect with default 1 |
seed |
number used to initialize a pseudorandom number generator (default seed = 1). The random number generator method used is "base::Wichmann-Hill". |
quiet |
if TRUE, then messages generated during compilation will be suppressed (default TRUE). |
plot |
if TRUE, the autocorrelation, trace, and density plots will be generated (default TRUE). |
Value
The function returns a list with the following objects : Estimation Est
, random effect variance refVar
, beta coefficient Coefficient
and MCMC result result_mcmc
References
Battese, G. E., Harter, R. M., & Fuller, W. A. (1988). An error-components model for prediction of county crop areas using survey and satellite data. Journal of the American Statistical Association, 83(401), 28-36.
Rao, J. N., & Molina, I. (2015). Small area estimation. John Wiley & Sons.
Examples
library(dplyr)
Xarea <- cornsoybeanmeans %>%
dplyr::select(
County = CountyIndex,
CornPix = MeanCornPixPerSeg,
SoyBeansPix = MeanSoyBeansPixPerSeg
)
corn_model <- hb_unit(
CornHec ~ SoyBeansPix + CornPix,
data_unit = cornsoybean,
data_area = Xarea,
domain = "County",
iter.update = 20
)