Learn R Programming

BayesSAE (version 1.0-2)

replication: Replicated Data

Description

This function draws replicated data from posterior predictive distributions. With these replications, one can display graphical posterior checks or compute the Bayesian p-value to see whether the model fits the data well. See details in Gelman et. al (2006).

Usage

replication(object, repperdr = 1, ...)

Arguments

object

an object of class obtained by BayesSAE function.

repperdr

number of replicated data each posterior draw generated. See also Details.

...

currently not used

Value

m * k matrix of replicated data where m is the number of domains. Values are sorted as the direct estimators.

Details

Let \(\theta\) denote all the parameters in the model, and \(\theta^{i}, i = 0, 1, \ldots, n\) be the n posterior draws. Supposing the argument repperdr is 5, and then 5 replications would be obtained from the distribution \(p(y|\theta^{i})\) for each \(i\).

References

You, Y. and Chapman, B. (2006) Small Area Estimation Using Area Level Models and Estimated Sampling Variances. Survey Methodology, 32: 97-103.

See Also

BayesSAE

Examples

Run this code
# NOT RUN {
#load data set
data(SAIPE)

#obtain MCMC draws
result <- BayesSAE(SACPR~SNAPR+CenPR+CPER|Vardir, data = SAIPE, mcmc = 5000)

#obtain replicated data
replication(result)
# }

Run the code above in your browser using DataLab