BTRR_GGM: Bayesian Tensor Response Regression with Gaussian Graphical...

View source: R/401_BTRR_GGM.R

BTRR_GGMR Documentation

Bayesian Tensor Response Regression with Gaussian Graphical Model

Description

Performs the MCMC to draw from the posterior distribution for the model published by Spencer, Guhaniyogi, and Prado (2020).

Usage

BTRR_GGM(
  input,
  n_iter = 100,
  n_burn = 0,
  Rank = 1,
  hyperparameters = NULL,
  save_after = NULL,
  save_llik = TRUE,
  results_file = NULL,
  num_cores = parallel::detectCores() - 2,
  save_dir = "."
)

Arguments

input

an object of class TRR_GGM_data or a list with elements Y (a list of G arrays with dimensions p_1\times \cdots \times p_D \times T \times n) and x (a T \times n matrix).

n_iter

(a scalar) the number of posterior samples desired

n_burn

(a scalar) the number of posterior samples to discard as a burn-in

Rank

(a positive integer) the rank for the PARAFAC/CP tensor decomposition

hyperparameters

a list with named numbers containing at least one of the following: a.tau, b.tau, a.lambda, b.lambda, a.epsilon, or b.epsilon defining the values of the hyperparameters within the model. If NULL, then default values will be used.

save_after

(an integer) An .rds file will be saved every save_after MCMC iterations with all of the results to that point (helpful for getting intermediate results in less time)

save_llik

(a logical) Should the log-likelihood be calculated and saved at each iteration? Doing so comes at a cost, but can be used for model diagnostics. Defaults to TRUE.

results_file

(optional) The relative path to a result file. This is used to continue an MCMC chain on a set of data for which some results already exist.

num_cores

The number of cores used for running the code in parallel

save_dir

(a character) A path to a directory in which the temporary results will be saved. Defaults to the current working directory.

Value

A list object with the posterior draws from the MCMC chain.

Examples

## Not run: 
input <- TRR_GGM_simulated_data()
results <- BTRR_GGM(input)

## End(Not run)

danieladamspencer/bayestensorreg documentation built on July 23, 2024, 10:14 a.m.