HIfit: Hierarchical Imputation Model

Description Usage Arguments Value Methods (by generic)

View source: R/HIfit.R

Description

Fit a Bayesian Hierarchical model to make 'shrinkage' estimation and impute missing values in aggregated data.

Usage

1
2
3
4
HIfit(X_fix, X_hier, Y, Ysd, Nsam, isDat, model = c("binomial", "normal"), ...)

## S3 method for class 'HIfit'
plot(x)

Arguments

X_fix

(numeric matrix) a model matrix (or design matrix) for fixed, non-hierarchical effects. We recommend using stats::model.matrix to generate this matrix.

X_hier

(integer/character/factor matrix) a indicator matrix of hierarchical effects.

Y

(numeric vector) an outcome vector. For model = "binomial", this will be a vector of observed success probability (e.g. prevalence, incidence). For model = "normal", this will be a vector of observed sample means. Note that NA's have to be replaced by any numeric values.

Ysd

(numeric vector) standard deviation for each observation. (required for model = "normal")

Nsam

(integer vector) population, or sample size for each observation.

isDat

(integer/logical vector) indicators which rows are observed (1, or TRUE) and which are missing values (0, or FALSE).

model

(character) the model type, one of "binomial" or "normal".

...

parameters for the sampling algorithm, such as

  • chains: number of the Markov chains (defaults to 4).

  • cores: number of cores to use when executing the chains in parallel (defaults to 1).

  • iter: number of iterations for each chain including warmup (defaults to 2000).

  • warmup: number of warmup (aka burnin) iterations for each chain (defaults to iter/2).

  • control : a named list of parameters to control the sampler's behavior, such as

    • adapt_delta: between 0 and 1, defaults to 0.8.

    • max_treedepth: positive integer, defaults to 10.

    • ...: for other parameters, see the details in the documentation for the control argument in rstan:stan().

Value

A HIfit object containing the following components.

Methods (by generic)


dachuwu/TBDtoolbox documentation built on Dec. 27, 2021, 8:11 p.m.