HurdleNB: Small Area Estimation using Hierarchical Bayesian under...

Description Usage Arguments Value Examples

View source: R/HurdleNB.R

Description

This function is implemented to variable of interest (y) that assumed to be a Hurdle Negative Binomial Distribution. The range of data is (0 < y < ∞). This model can be used to handle overdispersion and excess zero in data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
HurdleNB(
  formula,
  iter.update = 3,
  iter.mcmc = 2000,
  coef.nonzero,
  var.coef.nonzero,
  coef.zero,
  var.coef.zero,
  thin = 2,
  burn.in = 1000,
  tau.u = 1,
  tau.v = 1,
  data
)

Arguments

formula

Formula that describe the fitted model

iter.update

Number of updates with default 3

iter.mcmc

Number of total iterations per chain with default 2000

coef.nonzero

Optional argument for the mean of the prior distribution of the model coefficients for variable of interest (y) which value is zero count

var.coef.nonzero

Optional argument of variance of coefficient non-zero

coef.zero

Optional argument for the mean of the prior distribution of the model coefficients for variable of interest (y) which value is zero count

var.coef.zero

Optional argument for variance of coefficient zero

thin

Thinning rate, must be a positive integer with default 1

burn.in

Number of iterations to discard at the beginning with default 1000

tau.u

Variance of random effect area for non-zero count of variable interest with default 1

tau.v

Variance of random effect area for zero count of variable interest with default 1

data

The data frame

Value

This function returns a list of the following objects:

Est

A vector with the values of Small Area mean Estimates using Hierarchical bayesian method

refVar

Estimated random effect variances

coefficient

A dataframe with the estimated model coefficient

plot

Trace, Density, Autocorrelation Function Plot of MCMC samples

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
##For data without any non-sampled area
data(dataHNB)     # Load dataset

result <- HurdleNB(y ~ x1 + x2, data = dataHNB)

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 dataHNBNs

rakaikmana/hurdlenb documentation built on Feb. 14, 2022, 12:49 a.m.