latent_dataset: Create a Latent Dataset Object

View source: R/fmri_dataset.R

latent_datasetR Documentation

Create a Latent Dataset Object

Description

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. (Typically, a LatentNeuroVec is created using the fmristore package.)

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.

Value

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

Examples

## Not run: 
# 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 (requires the fmristore package)
lvec <- fmristore::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)

## End(Not run)

bbuchsbaum/fmrireg documentation built on March 1, 2025, 11:20 a.m.