Learn R Programming

cudaBayesreg (version 0.3-16)

cudaMultireg.volume: CUDA Parallel Implementation of a Bayesian Multilevel Model for fMRI Data Analysis on a fMRI NIFTI volume

Description

cudaMultireg.volume provides an interface to a CUDA implementation of a Bayesian multilevel model for the analysis of brain fMRI data. Data is processed on a slice-by-slice basis. Data volumes in gzipped NIFTI format are used.

Usage

cudaMultireg.volume(fbase=NULL, R=2000, keep=5, nu.e=3, zprior=FALSE, rng=0, rg=c(NULL,NULL), swap=FALSE, savedir=tempdir())

Arguments

fbase
If fbase is left unspecified (default NULL), then user datasets need to be provided as input. Otherwise, fbase indicates the dataset prefix of one of the two demo fMRI datasets to use. Three data files are required as input. User specified data files must have the names generated by the FSL/FEAT pre-processing tool, namely ‘filtered_func_data.nii.gz’, ‘mask.nii.gz’, and ‘design.mat’. ‘filtered_func_data.nii.gz’ specifies the dataset to be analyzed, ‘mask.nii.gz’ specifies the dataset to be used as mask. ‘design.mat’ specifies the dataset to be used as design matrix. Typically, these datasets are obtained using the FSL/FEAT pre-processing tool, or other similar tool. In cudaBayesreg, versions 10+, read.fmrislice uses the ‘design.mat’ format from FSL/FEAT. The prefix fbase applies to the demo data files provided in the complementary package cudaBayesregData: ‘{fbase}_filtered_func.nii.gz’, ‘{fbase}_mask.nii.gz’, and ‘{fbase}_design.mat’. Two test datasets are included in the package: one with prefix fmri, the other with prefix swrfM. The prefix swrfM is used in the random effects example. See also read.Zsegslice for user-defined segmented masks.
R
number of MCMC draws
keep
MCMC thinning parameter: keep every keepth draw (def: 5)
nu.e
d.f. parameter for regression error variance prior (def: 3)
zprior
Boolean {T,F}; default {F} - use just a mean for Z (see model description in cudaMultireg.slice.
rng
integer {0,1,2}: type of RNG to use {0-Marsaglia Multicarry, 1-R. P. Brent xorgens, 2-Mersenne Twister MT19937-64}; (def. 0-Marsaglia Multicarry)
rg
rg=c(first, last): a vector containing the first and last numbers of the sequence of slices to be processed. If rg=c(NULL,NULL) (default), all slices in the volume are processed.
swap
logical variable (default = FALSE) for choosing the right/left data display convention consistent with FSLVIEW
savedir
Directory (def: tempdir()) were the MCMC simulations for all slices are going to be saved.

Details

The statistical model implemented in CUDA was specified as a Gibbs Sampler for hierarchical linear models with a normal prior. The main computational work is done in parallel on a CUDA capable GPU. Each thread is responsible for fitting a general linear model at each voxel. Data volumes are processed on a slice-by-slice basis, before reconstructing the processed volume, using build.zstatvolume. The statistical model is specified in cudaMultireg.slice. To run the examples, the data sets from the R-package cudaBayesregData are required.

References

Adelino R. Ferreira da Silva (2011). ``cudaBayesreg: Parallel Implementation of a Bayesian Multilevel Model for fMRI Data Analysis.'' Journal of Statistical Software, 44(4), 1--24. URL http://www.jstatsoft.org/v44/i04/.

Adelino Ferreira da Silva (2011). cudaBayesregData: Data sets for the examples used in the package cudaBayesreg, R package version 0.3-10. URL http://CRAN.R-project.org/package=cudaBayesregData.

Adelino Ferreira da Silva (2011). ``A Bayesian Multilevel Model for fMRI Data Analysis.'', Computer Methods and Programs in Biomedicine, 102,(3), 238--252.

Adelino Ferreira da Silva (2010). ``cudaBayesreg: Bayesian Computation in CUDA.'', The R Journal, 2/2, 48-55. URL http://journal.r-project.org/archive/2010-2/RJournal_2010-2_Ferreira~da~Silva.pdf.

Rossi, Allenby and McCulloch. Bayesian Statistics and Marketing, Chapter 3. URL http://faculty.chicagogsb.edu/peter.rossi/research/bsm.html.

Davies, R.B. (1994). Writing a matrix package in C++. In OON-SKI'94: The second annual object-oriented numerics conference, pp 207-213. Rogue Wave Software, Corvallis. URL http://www.robertnz.net/cpp\_site.html.

Richard. P. Brent. Some long-period random number generators using shifts and xors, Preprint: 2 July 2007.

Brandon Whitcher, Volker Schmid and Andrew Thornton (2011). oro.nifti: Rigorous - NIfTI Input / Output, R package version 0.2.5. URL http://CRAN.R-project.org/package=oro.nifti.

See Also

cudaMultireg.slice, buildzstat.volume, read.fmrislice, read.Zsegslice, premask, pmeans.hcoef, regpostsim, plot.hcoef.post, post.simul.hist, post.ppm, post.tseries, post.randeff, post.shrinkage.mean

Examples

Run this code
## Not run: 
# ## simulation using the SPM auditory dataset "swrfM*" 
# cudaMultireg.volume(fbase="swrfM", R=2000, rg=c(13,16), savedir=tempdir())
# buildzstat.volume(fbase="swrfM", rg=c(13,16))
# post.overlay(fbase="swrfM", vreg=2, rg=c(13,16), view="axial")
# ##
# ## Random effects simulation using the SPM auditory dataset "swrfM*" 
# cudaMultireg.volume(fbase="swrfM", R=2000, zprior=TRUE, rng=1,
#   rg=c(17,21),  savedir=tempdir())
# buildzstat.volume(fbase="swrfM", rg=c(17,21))
# post.overlay(fbase="swrfM", vreg=2, rg=c(17,21), view="axial")
# ##
# ## Simulation using the visual/auditory test dataset "fmri"  
# cudaMultireg.volume(fbase="fmri", R=2000, savedir=tempdir())
# buildzstat.volume(fbase="fmri", vreg=2)
# post.overlay(fbase="fmri", vreg=2, view="axial")
# buildzstat.volume(fbase="fmri", vreg=4)
# post.overlay(fbase="fmri", vreg=4, view="axial")
# ## End(Not run)

Run the code above in your browser using DataLab