waveletcoef: Apply discrete wavelet transform (DWT) to a 2D GLM...

View source: R/BHMSMA.R

waveletcoefR Documentation

Apply discrete wavelet transform (DWT) to a 2D GLM coefficient map of a regressor

Description

waveletcoef applies DWT to a 2D GLM coefficient map (e.g., corresponding to a single brain slice) of a regressor for each subject, and returns the wavelet coefficients at all resolution levels. This function wraps around the wavelet transformation function imwd of the wavethresh package.

Usage

waveletcoef(n, grid, glmcoefstd, wave.family="DaubLeAsymm", 
  filter.number=6, bc="periodic")

Arguments

n

Number of subjects.

grid

The number of voxels in one row (or, one column) of the brain slice of interest. Must be a power of 2. The total number of voxels is grid^2. The maximum value of grid for this package is 512.

glmcoefstd

An array of dimension (n,grid,grid), containing for each subject the standardized GLM coefficients of a regressor obtained by fitting GLM to the time-series corresponding to the voxels.

wave.family

The family of wavelets to use - "DaubExPhase" or "DaubLeAsymm". Default is "DaubLeAsymm".

filter.number

The number of vanishing moments of the wavelet. Default is 6.

bc

The boundary condition to use - "periodic" or "symmetric". Default is "periodic".

Details

The wavelet decomposition is performed by using the function imwd.

Value

A list containing the following.

WaveletCoefficientMatrix

A matrix of dimension (n,grid^2-1), containing for each subject the wavelet coefficients of all levels stacked together (by the increasing order of resolution level).

Author(s)

Nilotpal Sanyal, Marco Ferreira

Maintainer: Nilotpal Sanyal <nilotpal.sanyal@gmail.com>

See Also

imwd, hyperparamest

Examples

set.seed(1)
n <- 3
grid <- 8
ntime <- 10
designmat <- cbind( rep(1,10), c(rep(c(1,0),5)) )
data <- array(dim=c(n,grid,grid,ntime),
  rnorm(n*grid*grid*ntime))
glm.fit <- glmcoef(n,grid,data,designmat)
glmcoefstd <- glm.fit$GLMCoefStandardized[,,,1]
wavecoef <- waveletcoef(n,grid,glmcoefstd)
dim(wavecoef$WaveletCoefficientMatrix)
#[1]  3 63

BHMSMAfMRI documentation built on Oct. 2, 2022, 9:05 a.m.