Skip to contents

This function creates a latent dataset object, which encapsulates a dimension-reduced subspace of "latent variables". The dataset is a list containing information about the latent neuroimaging vector, TR, number of runs, event table, base path, sampling frame, and censor.

Usage

latent_dataset(lvec, TR, run_length, event_table = data.frame())

Arguments

lvec

An instance of class LatentNeuroVec.

TR

Repetition time (TR) of the fMRI acquisition.

run_length

A numeric vector specifying the length of each run in the dataset.

event_table

An optional data frame containing event information. Default is an empty data frame.

base_path

An optional base path for the dataset. Default is "." (current directory).

censor

An optional numeric vector specifying which time points to censor. Default is NULL.

Value

A latent dataset object of class c("latent_dataset", "fmri_dataset", "list").

Examples

# Create a matrix with 100 rows and 1000 columns (voxels)
X <- matrix(rnorm(100*1000), 100, 1000)
pres <- prcomp(X)
basis <- pres$x[,1:25]
loadings <- pres$rotation[,1:25]
offset <- colMeans(X)

# Create a LatentNeuroVec object
lvec <- neuroim2::LatentNeuroVec(basis, loadings, neuroim2::NeuroSpace(c(10,10,10,100)), 
mask=rep(TRUE,1000), offset=offset)

# Create a latent_dataset
dset <- latent_dataset(lvec, TR=2, run_length=100)