BTRR_single_subject: Single-subject Bayesian Tensor Response Regression

View source: R/400_BTRR_single_subject.R

BTRR_single_subjectR Documentation

Single-subject Bayesian Tensor Response Regression

Description

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

Usage

BTRR_single_subject(
  input,
  n_iter = 100,
  n_burn = 0,
  rank = 1,
  hyperparameters = NULL,
  save_after = NULL,
  save_llik = TRUE,
  save_dir = "."
)

Arguments

input

an object of class TRR_data or a list with elements Y (an array with dimensions p_1\times \cdots \times p_D \times T \times 1) and x (a T \times 1 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.

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 with the posterior samples

Examples

## Not run: 
input <- TRR_simulated_data()
results <- BTRR_single_subject(input)

## End(Not run)

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