| BHMSMA {BHMSMAfMRI} | R Documentation | 
Bayesian hierarchical multi-subject multiscale analysis (BHMSMA) of functional MRI data or other multiscale data
Description
BHMSMA is the main function that performs BHMSMA (Sanyal & Ferreira, 2012) of fMRI data, or other multiscale data, using wavelet-based prior that borrows strength across subjects and provides posterior smooth estimates of the effect sizes. Specifically, BHMSMA constructs a 2D regression coefficient map (e.g., corresponding to a single brain slice) of a given regressor and returns its posterior smoothed version based on multi-subject or single subject analyses.
Usage
BHMSMA(n, grid, data, designmat, k, analysis="multi", 
  truecoef=NULL, wave.family="DaubLeAsymm", filter.number=6, 
  bc="periodic")
Arguments
| n | Number of subjects. | 
| grid | The number of voxels in one row (or column) of the brain slice of interest. Must be a power of 2. The total number of voxels is  | 
| data | The data in the form of an array with dimension  | 
| designmat | The design matrix used to generate the data. The rows must correspond to  | 
| k | Index of the regressor chosen for analysis, consistently with  | 
| analysis | "MSA" or "SSA", depending on whether performing multi-subject analysis or single subject analysis. | 
| truecoef | If available, the true GLM coefficients in the form of an array with dimension  | 
| 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 computations are performed by using the R package wavethresh.
Value
A list containing the following.
| GLMCoefStandardized | An array of dimension  | 
| GLMCoefSE | An array of dimension  | 
| WaveletCoefficientMatrix | A matrix of dimension  | 
| hyperparam | A vector containing the estimates of the six hyperparameters. | 
| hyperparamVar | Estimated covariance matrix of the hyperparameters. | 
| posteriorMixProb | A matrix of dimension  | 
| PostMeanWaveletCoef | A matrix of size  | 
| GLMcoefposterior | An array of dimension  | 
| MSE | MSE of the posterior estimates of the GLM coefficients, if the true values of the GLM coefficients are available. | 
Author(s)
Nilotpal Sanyal, Marco Ferreira
Maintainer: Nilotpal Sanyal <nilotpal.sanyal@gmail.com>
References
Sanyal, Nilotpal, and Ferreira, Marco A.R. (2012). Bayesian hierarchical multi-subject multiscale analysis of functional MRI data. Neuroimage, 63, 3, 1519-1531.
See Also
readfmridata, glmcoef, waveletcoef, hyperparamest, postmixprob, postwaveletcoef, substituteWaveletCoef, postglmcoef, imwd, imwr
Examples
# BHMSMA multi-subject analysis for simulated (fMRI) 
# data at 4 timepoints over an 8x8 grid (of a brain 
# slice) for 3 subjects
set.seed(1)
n <- 3
grid <- 8
ntime <- 4
data <- array(rnorm(n*grid*grid*ntime),
  dim=c(n,grid,grid,ntime))
designmat <- cbind(c(1,1,1,1),c(1,0,1,0))
k <- 2
analysis <- "multi"
BHMSMAmulti <- BHMSMA(n, grid, data, designmat, 
  k, analysis)
zlim = c(0,max(abs(BHMSMAmulti$GLMCoefStandardized)))
par(mfrow=c(1,2))
image( abs(BHMSMAmulti$GLMCoefStandardized[1,,,k]),
  col=heat.colors(12),zlim=zlim,main="GLM coef map")
image( abs(BHMSMAmulti$GLMcoefposterior[1,,]),
  col=heat.colors(12),zlim=zlim,main="GLM coef posterior map")
## Not run: 
# BHMSMA multi-subject analysis for simulated (fMRI) 
# data at 100 timepoints over an 64x64 grid (of a 
# brain slice) for 15 subjects
# (takes ~12s in a 2.8 GHz Quad-Core Intel Core i7 processor)
set.seed(1)
n <- 15
grid <- 64
ntime <- 100
data <- array(rnorm(n*grid*grid*ntime),
          dim=c(n,grid,grid,ntime))
designmat <- cbind(rep(1,ntime),runif(ntime))
k <- 2
analysis <- "multi"
system.time({BHMSMAmulti <- BHMSMA(n,grid,data, 
  designmat,k,analysis)})
## End(Not run)