MyNixOS website logo
Description

Bayesian Hierarchical Multi-Subject Multiscale Analysis of Functional MRI (fMRI) Data.

Package BHMSMAfMRI performs Bayesian hierarchical multi-subject multiscale analysis of fMRI data as described in Sanyal & Ferreira (2012) <DOI:10.1016/j.neuroimage.2012.08.041>, or other multiscale data, using wavelet-based prior that borrows strength across subjects and provides posterior smoothed images of the effect sizes and samples from the posterior distribution.

BHMSMAfMRI: Bayesian Hierarchical Multi-Subject Multiscale Analysis of fMRI Data

CRANstatus R-CMD-check CodeFactor

BHMSMAfMRI performs Bayesian hierarchical multi-subject multiscale analysis of function MRI (fMRI) data as described in Sanyal & Ferreira (2012), or other multiscale data, using wavelet based prior that borrows strength across subjects and provides posterior smooth estimates of the effect sizes and samples from their posterior distribution.

Installation

Install from CRAN

install.packages("BHMSMAfMRI")

Install from GitHub

# install.packages("devtools")
devtools::install_github("nilotpalsanyal/BHMSMAfMRI")

The main function:

BHMSMA is the main function which accepts fMRI data as a 4D array (see code below) and a design matrix. For the time-series of all voxels, a general linear model (GLM) is fit with all the regressors in the design matrix. After that, the standardized regression coefficient map of a regressor of interest is subjected to further analysis. The function BHMSMA returns the posterior smoothed map of the regression coefficients. Below is a basic illustration of its use. For a detailed manual, see the package vignette.

library(BHMSMAfMRI)
#> 
#>  Welcome! Thanks for trying BHMSMAfMRI.
#>  
#>  Website: https://nilotpalsanyal.github.io/BHMSMAfMRI/
#>  Bug report: https://github.com/nilotpalsanyal/BHMSMAfMRI/issues

# Read data from image files
fpath <- system.file("extdata", package="BHMSMAfMRI")
untar(paste0(fpath,"/fmridata.tar"), exdir=tempdir())
n <- 3
grid <- 32
ntime <- 9
data <- array(dim=c(n,grid,grid,ntime))
for(subject in 1:n)
{
  directory <- paste0(tempdir(),"/fmridata","/s0",subject,"/")
  a <- readfmridata(directory, format="Analyze", prefix=paste0("s0",subject,"_t"),
                    nimages=9, dim.image=c(grid,grid,1))
  data[subject,,,] <- a[,,1,]
}
data(fmridata)
names(fmridata)
#> [1] "grid"         "nsubject"     "TrueCoeff"    "DesignMatrix"
truecoef <- fmridata$TrueCoeff
designmat <- fmridata$DesignMatrix

# Perform analyses
k <- 2  #consider the second regressor
analysis <- "multi"     #perform multi-subject analysis (MSA)
BHMSMAmulti <- BHMSMA(n, grid, data, designmat, k, analysis, truecoef)
analysis <- "single"     #perform single subject analysis (SSA)
BHMSMAsingle <- BHMSMA(n, grid, data, designmat, k, analysis, truecoef)

# Compare results for the first subject
zlim = c(0,max(abs(BHMSMAmulti$GLMCoefStandardized[1,,,k])))
par(mfrow=c(2,2))
image( truecoef[1,,],col=heat.colors(12),main="true map")
image( abs(BHMSMAsingle$GLMCoefStandardized[1,,,k]),
       col=heat.colors(8),zlim=zlim,main="GLM coef map")
image( abs(BHMSMAsingle$GLMcoefposterior[1,,]),
       col=heat.colors(8),zlim=zlim,main="posterior map SSA")
image( abs(BHMSMAmulti$GLMcoefposterior[1,,]),
       col=heat.colors(8),zlim=zlim,main="posterior map MSA")

References:

Sanyal, Nilotpal, and Ferreira, Marco A.R. (2012). Bayesian hierarchical multi-subject multiscale analysis of functional MRI data. Neuroimage, 63, 3, 1519-1531. <span target="_blank">https://doi.org/10.1016/j.neuroimage.2012.08.041></span.

Metadata

Version

2.2

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows