#' Compute the posterior mean and variance of h at a new predictor values Function to estimate the posterior mean and variance by obtaining the posterior mean and variance at #' particular iterations and then using the iterated mean and variance formulas. This function returns the entire mean matrix and variance array needed for each of the future functions to obtain an unbiased estimate of the SE used to create CI in plots.

ComputePostmeanHnew.exact.MI(
  fit,
  y = NULL,
  Z = NULL,
  X = NULL,
  Znew = NULL,
  sel = NULL
)

Arguments

fit

An object contatinint the results return by the kmbayes function

y

a vector of outcome data of length n.

Z

an n-by-M matrix of predictor variables to be included in the h function. Each row represents an observation and each column represents an predictor.

X

an n-by-K matrix of covariate data where each row represents an observation and each column represents a covariate. Should not contain an intercept column.

Znew

matrix of new predictor values at which to predict new h, where each row represents a new observation. If set to NULL then will default to using the observed exposures Z

sel

selects which iterations of the MCMC sampler to use for inference

Value

A list of mean, variance, entire mean matrix and variance array