make_gibbs_sampler | R Documentation |
A maker function that returns a function. The returned function is a Gibbs sampler for the traditional Fay-Herriot model.
make_gibbs_sampler(X, Y, D, var_gamma_a=1, var_gamma_b=1)
X |
observed independent data to be analyzed |
Y |
observed dependent data to be analyzed |
D |
known precisions of response |
var_gamma_a |
latent variance prior parameter, |
var_gamma_b |
latent variance prior parameter, |
Returns a Gibbs sampler, itself a function of initial parameter values (a list with values for \beta, \theta
, and latent variance of \theta
), number of samples, and thinning rate.
Marten Thompson thom7058@umn.edu
n <- 10
X <- matrix(1:n, ncol=1)
Y <- 2*X + rnorm(n, sd=1.1)
D <- rep(1, n)
gib <- make_gibbs_sampler(X, Y, D)
params.init <- list(
beta=1,
theta=rep(0,n),
theta.var=1
)
gib.out <- gib(params.init, 5, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.