make_gibbs_sampler {agfh}R Documentation

Maker Function: Traditional Fay-Herriot Gibbs Sampler

Description

A maker function that returns a function. The returned function is a Gibbs sampler for the traditional Fay-Herriot model.

Usage

  make_gibbs_sampler(X, Y, D, var_gamma_a=1, var_gamma_b=1)

Arguments

X

observed independent data to be analyzed

Y

observed dependent data to be analyzed

D

known precisions of response Y

var_gamma_a

latent variance prior parameter, rgamma shape

var_gamma_b

latent variance prior parameter, rgamma rate

Value

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.

Source

Marten Thompson thom7058@umn.edu

Examples

  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)

[Package agfh version 0.2.1 Index]