Learn R Programming

⚠️There's a newer version (0.10.1) of this package.Take me there.

BayesfMRI

The BayesfMRI R package includes the main function BayesGLM, which implements a spatial Bayesian GLM for task fMRI. It also contains a wrapper function BayesGLM_cifti, for CIFTI cortical surface fMRI data.

Citation

If you use BayesfMRI please cite the following papers:

NameAPA Citation
Spatial Bayesian GLMMejia, A. F., Yue, Y., Bolin, D., Lindgren, F., & Lindquist, M. A. (2020). A Bayesian general linear modeling approach to cortical surface fMRI data analysis. Journal of the American Statistical Association, 115(530), 501-520.
Multi-session Spatial Bayesian GLMSpencer, D., Yue, Y. R., Bolin, D., Ryan, S., & Mejia, A. F. (2022). Spatial Bayesian GLM on the cortical surface produces reliable task activations in individuals and groups. NeuroImage, 249, 118908.

You can also obtain citation information from within R like so:

citation("BayesfMRI")

Important Note on Dependencies:

BayesfMRI depends on the ciftiTools package, which requires an installation of Connectome Workbench. It can be installed from the HCP website.

On Mac platforms, an installation of Xcode is necessary to build the C++ code included in BayesfMRI.

Copy Link

Version

Install

install.packages('BayesfMRI')

Monthly Downloads

223

Version

0.3.11

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Amanda Mejia

Last Published

December 18th, 2023

Functions in BayesfMRI (0.3.11)

ELL

Expected log-likelihood function
BayesGLM_cifti

BayesGLM for CIFTI
EM_Param

EM
BayesGLM2

Group-level Bayesian GLM
BayesGLM_argChecks

Bayes GLM arg checks
GLMEM_fixptseparate

Fixed point function for the joint BayesGLMEM update algorithm
BayesGLM

BayesGLM
AICc

Corrected AIC
F.logwt

F logwt
Bayes_Param

Bayes
aic_Param

aic
act_prevalance

Activations prevalence.
contrasts_Param

contrasts
create_listRcpp

Function to prepare objects for use in Rcpp functions
INLA_Description

INLA
combine_sessions_Param

combine_sessions
beta.posterior.thetasamp

Beta posterior theta sampling
TrQbb

Trace of Q beta' beta
cAIC

Corrected AIC To-Do
INLA_deps

Import INLA dependencies
cholQsample

Sample from the multivariate normal distribution with Cholesky(Q)
TrSigB

Hutchinson estimator of the trace
.initialKP

Find the initial values of kappa2 and phi
emTol_Param

emTol
.logDetQt

Find the log of the determinant of Q_tilde
Q_prime

Gives the portion of the Q matrix independent of phi
TrQEww

Trace approximation function
ar_order_Param

ar_order
faces_Param

faces
galerkin_db

Create FEM matrices
.findTheta

Perform the EM algorithm of the Bayesian GLM fitting
id_activations.posterior

Identify activations using joint posterior probabilities
.getSqrtInvCpp

Get the prewhitening matrix for a single data location
id_activations.classical

Identification of areas of activation in a General Linear Model using classical methods
GLMEM_objfn

Objective function for the BayesGLM EM algorithm
init_fixpt

The fix point function for the initialization of kappa2 and phi
extract_estimates

Extract Estimates of Activation
init_objfn

Objective function for the initialization of kappa2 and phi
ar_smooth_Param

ar_smooth
make_mask

Mask out invalid data
make_mesh

Make Mesh
mesh_Param_either

mesh: either
mesh_Param_inla

mesh: INLA only
is.a_session

Validate an individual session in a "BfMRI.sess" object.
neg_kappa_fn2

The negative of the objective function for kappa without Sig_inv
is.BfMRI.sess

Validate a "BfMRI.sess" object.
organize_data_pw

Organize prewhitened data for Bayesian GLM
neg_kappa_fn

The negative of the objective function for kappa
plot.BayesGLM2_cifti

S3 method: use view_xifti_surface to plot a "BayesGLM2_cifti" object
plot.BayesGLM_cifti

S3 method: use view_xifti_surface to plot a "BayesGLM_cifti" object
neg_kappa_fn3

Streamlined negative objective function for kappa2 using precompiled values
plot.act_BayesGLM_cifti

S3 method: use view_xifti_surface to plot a "act_BayesGLM_cifti" object
plot.prev_BayesGLM_cifti

S3 method: use view_xifti to plot a "prev_BayesGLM_cifti" object
make_data_list

Make data list for estimate_model
make_Q

Make the full SPDE precision based on theta, the spde, and the number of sessions
HRF

Canonical (double-gamma) HRF
check_INLA

Check INLA and PARDISO
cderiv

Central derivative
pw_smooth

Smooth AR coefficients and white noise variance
summary.BayesGLM_cifti

Summarize a "BayesGLM_cifti" object
neg_kappa_fn4

Streamlined negative objective function for kappa2 using precompiled values
pw_estimate

Estimate residual autocorrelation for prewhitening
return_INLA_Param

return_INLA
summary.BayesGLM2_cifti

Summarize a "BayesGLM2_cifti" object
seed_Param

seed
qsample

Sample from a multivariate normal with mean and precision
s2m

Sequential 2-means variable selection
prep_kappa2_optim

Find values for coefficients used in objective function for kappa2
session_names_Param

session_names
summary.prev_BayesGLM_cifti

Summarize a "prev_BayesGLM_cifti" object
summary.prev_BayesGLM

Summarize a "prev_BayesGLM" object
vertex_areas

Surface area of each vertex
summary.act_BayesGLM_cifti

Summarize a "act_BayesGLM_cifti" object
summary.act_BayesGLM

Summarize a "act_BayesGLM" object
get_posterior_densities

Extracts posterior density estimates for hyperparameters
summary.BayesGLM2

Summarize a "BayesGLM2" object
summary.BayesGLM

Summarize a "BayesGLM" object
retro_mask_mesh

Retroactively mask locations from mesh.
retro_mask_BGLM

Retroactively mask locations from BayesGLM result.
task_names_Param

task_names
trim_INLA_Param

trim_INLA
vertices_Param

vertices
organize_replicates

Organize replicates
s2m_B

Sequential 2-means on array B
spde_Q_phi

Calculate the SPDE covariance
scale_BOLD_Param

scale_BOLD
id_activations

Identify task activations
mask_Param_vertices

mask: vertices
make_HRFs

Make HRFs
max.threads_Param

max.threads
submesh

Remove part of a mesh without using INLA functions
num.threads_Param

num.threads
organize_data

Organize data for Bayesian GLM
kappa_init_fn

Function to optimize over kappa2
verbose_Param

verbose
scale_design_Param

scale_design
scale_design_mat

Scale the design matrix
trim_INLA_model_obj

Trim INLA object