PoissonGamma {saeHB} | R Documentation |
Small Area Estimation using Hierarchical Bayesian under Poisson Gamma Distribution
Description
This function is implemented to variable of interest (y)
that assumed to be a Poisson Distribution which it is parameter (\lambda)
is assumed to be a Gamma distribution. The data is a count data, y = 1,2,3,...
Usage
PoissonGamma(
formula,
iter.update = 3,
iter.mcmc = 10000,
coef,
var.coef,
thin = 2,
burn.in = 2000,
tau.u = 1,
data
)
Arguments
formula |
Formula that describe the fitted model |
iter.update |
Number of updates with default |
iter.mcmc |
Number of total iterations per chain with default |
coef |
a vector contains prior initial value of Coefficient of Regression Model for fixed effect with default vector of |
var.coef |
a vector contains prior initial value of variance of Coefficient of Regression Model with default vector of |
thin |
Thinning rate, must be a positive integer with default |
burn.in |
Number of iterations to discard at the beginning with default |
tau.u |
Prior initial value of inverse of Variance of area random effect with default |
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, Dencity, Autocorrelation Function Plot of MCMC samples |
Examples
##Load Dataset
library(CARBayesdata)
data(lipdata)
dataPoissonGamma <- lipdata
dataPoissonGammaNs <- lipdata
dataPoissonGammaNs$observed[c(2,9,15,23,40)] <- NA
##Compute Fitted Model
##observed ~ pcaff
## For data without any nonsampled area
formula = observed ~ pcaff
v= c(1,1)
c = c(0,0)
dat = dataPoissonGamma
## Using parameter coef and var.coef
saeHBPoissonGamma <- PoissonGamma(formula,coef=c,var.coef=v,iter.update=10,data=dat)
saeHBPoissonGamma$Est #Small Area mean Estimates
saeHBPoissonGamma$refVar #Random effect variance
saeHBPoissonGamma$coefficient #coefficient
#Load Library 'coda' to execute the plot
#autocorr.plot(saeHBPoissonGamma$plot[[3]]) is used to generate ACF Plot
#plot(saeHBPoissonGamma$plot[[3]]) is used to generate Density and trace plot
## Do not using parameter coef and var.coef
saeHBPoissonGamma <- PoissonGamma(formula,data=dataPoissonGamma)
## For data with nonsampled area use dataPoissonGammaNs