bhlm: Bayesian Hierarchical Latent Mixture Model

Description Usage Arguments Author(s) Examples

Description

Run a BHLM model with custom number of latent variables according to specified number of outcome options. The model sets priors for each outcome, group mean (theta) and estimate variance.

Run following for model specification (Graphical notation):

plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE) rasterImage(bhlm_model_spec,0,0,1,1)

Usage

1
2
3
4
5
6
7
bhlm(dataframe, grouping_factor_cols, estimate_col, outcome_options_col,
  outcome_options, outcome_priors, lambda_prior, theta_prior,
  field_theta_precision = NULL, identifier_col = NULL,
  bayes_method = "jags", jags_init = NULL, jags_chains = 3,
  jags_iter = 2000, jags_burnin = floor(jags_iter/2), jags_thin = max(1,
  floor(jags_chains * (jags_iter - jags_burnin)/1000)), jags_DIC = TRUE,
  save_model = NULL)

Arguments

dataframe

A data frame with studies, two grouping factor cols (e.g. studies*outcomes), estimates, and optional ID column.

grouping_factor_cols

A data vector of two grouping factor columns of the data frame (e.g. c("Study", "Outcome")). These columns must be integer vectors.

estimate_col

Column of estimates in the data frame.

outcome_options_col

Column containing the different outcome names

Outcomes : Factor w/ 3 levels "Physical","Psychological",..: 2 2 2 2 2 2 2 2 1 1 ...

outcome_options

Chosen outcomes. You can choose a subset of outcomes.

outcome_priors

Priors for outcomes. Takes character vector or matrix.

Define all outcome priors to one distribution set prior (throws Warning) as character:

"dnorm(0, 1)"

Priors defined as character strings are checked with regex:

grepl("^[a-zA-Z]+\(((\d*\.)*\d+,\s?)*(\d*\.)*\d+\)", .)

or as data vector

c("dnorm", 0, 1)

Define all outcome priors manually with matrix. Notice: byrow = TRUE

matrix(c("dnorm", 0, 1, "dnorm", 0, 1.1), nrow = 'number of outcomes', ncol = 'maximum amount of dist parameters', byrow = TRUE)

or as character vector of characters

c("dnorm(0,1)", "dnorm(0,1.1)")

Notice: priors set manually, are set in the same order as outcome_options in character vector or in matrix row order (top to bottom).

lambda_prior

Prior for Lambda as character or data vector.

theta_prior

Prior for Theta as character or data vector.

identifier_col

ID column. Chosen column is added to the used data for easier overview.

bayes_method

Use JAGS or STAN (currently only JAGS is implemented).

save_model

Input FALSE to not save the model file, NULL to save as 'model_file.txt' in working directory, or filepath location with name to save the model file as .txt (Separated with '\' or '/').

field_theta

Optional: Include a another hierarchical level in the form of a field-wide mean distribution. Use a string vector with the same distribution as theta_prior and precision (no mean). The field-wide mean prior, is set to theta_prior. This solution is currently a fix-up, and should only be used on a case by case basis.

jags

Parameters for R2jags::jags:

init (NULL set as default), chains, iter (iterations per chain), burning (length of burn), thin (sim thinning rate), and DIC (compute deviance, pD and DIC).

Author(s)

Hugh Benjamin Zachariae

Examples

1
# INCOMING

arcuo/BHLM_package documentation built on May 23, 2019, 8:02 p.m.