postsamples.Rd
postsamples
generates samples from the posterior distribution of a 2D GLM coefficient map (e.g., corresponding to a single brain slice) of a regressor in the BHMSMA model for each subject based on multi-subject or single subject analyses (see References).
postsamples(nsample, n, grid, glmcoefstd, waveletcoefmat,
hyperparam, pkljbar, analysis, wave.family="DaubLeAsymm",
filter.number=6, bc="periodic", seed)
Number of samples to be generated.
Number of subjects.
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.
An array of dimension (n,grid,grid)
, containing for each subject the standardized GLM coefficients obtained by fitting GLM to the time-series corresponding to the voxels.
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).
A vector containing the estimates of the six hyperparameters.
A matrix of dimension (n,grid^2-1)
, containing the piklj bar values (see References for details).
"MSA" or "SSA", depending on whether performing multi-subject analysis or single subject analysis.
The family of wavelets to use - "DaubExPhase" or "DaubLeAsymm". Default is "DaubLeAsymm".
The number of vanishing moments of the wavelet. Default is 6.
The boundary condition to use - "periodic" or "symmetric". Default is "periodic".
Must be a positive integer. Provide to set random number generation seed for reproducibility.
A list containing the following.
An array of dimension (n,grid,grid,nsample)
, containing for each subject the posterior samples of the GLM coefficients.
An array of dimension (n,grid,grid)
, containing for each subject the posterior discovery maps of the GLM coefficients (for details see Morris et al. (2011)).
The wavelet computations are performed by using the R package wavethresh.
Sanyal, Nilotpal, and Ferreira, Marco A.R. (2012). Bayesian hierarchical multi-subject multiscale analysis of functional MRI data. Neuroimage, 63, 3, 1519-1531.
Morris, J.S. et al. (2011). Automated analysis of quantitative image data using isomorphic functional mixed models, with application to proteomic data. Ann. Appl. Stat. 5, 894-923.
set.seed(1)
n <- 3
grid <- 8
nsample <- 5
glmcoefstd <- array(rnorm(n*grid*grid),
dim=c(n,grid,grid))
waveletcoefmat <- array(rnorm(n*(grid^2-1)),
dim=c(n,(grid^2-1)))
hyperparam <- rep(.2,6)
pkljbar <- array(runif(n*(grid^2-1)),
dim=c(n,(grid^2-1)))
analysis <- "multi"
postsample <- postsamples(nsample,n,grid,glmcoefstd,
waveletcoefmat, hyperparam,pkljbar,analysis,seed=1)
#> Error in post_samp(nsample, grid, n, waveletcoefmat, pkljbar, C4, C5, seed): object '_BHMSMAfMRI_post_samp' not found
dim(postsample$samples)
#> Error in eval(expr, envir, enclos): object 'postsample' not found
#[1] 3 8 8 5