Learn R Programming

agfh (version 0.2.1)

hb_theta_new_pred: Traditional Fay-Herriot Hierarchical Bayesian Model Predictions

Description

Find predictions using posterior samples from the traditional Fay-Herriot hierarchical bayesian model

Usage

hb_theta_new_pred(X_new, beta_samples, theta_var_samples)

Value

Vector containing n samples-many estimates of \(\theta\) at X_new.

Arguments

X_new

single new independent data to be analyzed

beta_samples

posterior samples of latent regression parameter

theta_var_samples

posterior samples of latent variance parameter

Details

X_new should be \(1\) x \(p\) shaped.

beta_samples and theta_var_samples should contain the same number of samples (columns for the former, length of the latter).

Examples

Run this code
  p <- 3
  n.post.samp <- 10
  X.new <- matrix(rep(1,p), nrow=1)
  beta.samp <- matrix(rnorm(n.post.samp*p, mean=2, sd=0.1), ncol=n.post.samp)
  thvar.samp <- runif(n.post.samp, 0.1, 1)

  th.preds <- hb_theta_new_pred(X.new, beta.samp, thvar.samp)

Run the code above in your browser using DataLab