{"id":32206232,"url":"https://github.com/nilotpalsanyal/bhmsmafmri","last_synced_at":"2026-07-09T01:32:07.219Z","repository":{"id":59144291,"uuid":"533044338","full_name":"nilotpalsanyal/BHMSMAfMRI","owner":"nilotpalsanyal","description":"R package for Multi-Subject Multiscale Analysis of fMRI Data, or Other Multiscale Data","archived":false,"fork":false,"pushed_at":"2024-06-13T02:07:03.000Z","size":2274,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T15:56:32.079Z","etag":null,"topics":["bayesian-hierarchical-models","fmri-data-analysis","multiscale-data","wavelet-transform"],"latest_commit_sha":null,"homepage":"https://nilotpalsanyal.github.io/BHMSMAfMRI/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilotpalsanyal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-05T20:05:51.000Z","updated_at":"2022-09-16T08:15:36.000Z","dependencies_parsed_at":"2022-09-13T17:50:14.161Z","dependency_job_id":null,"html_url":"https://github.com/nilotpalsanyal/BHMSMAfMRI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nilotpalsanyal/BHMSMAfMRI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilotpalsanyal%2FBHMSMAfMRI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilotpalsanyal%2FBHMSMAfMRI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilotpalsanyal%2FBHMSMAfMRI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilotpalsanyal%2FBHMSMAfMRI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilotpalsanyal","download_url":"https://codeload.github.com/nilotpalsanyal/BHMSMAfMRI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilotpalsanyal%2FBHMSMAfMRI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280383000,"owners_count":26321423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-hierarchical-models","fmri-data-analysis","multiscale-data","wavelet-transform"],"created_at":"2025-10-22T05:09:26.168Z","updated_at":"2025-10-22T05:09:29.163Z","avatar_url":"https://github.com/nilotpalsanyal.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n\u003cimg src=\"man/figures/logo.png\" align=\"right\" style=\"float:right; height:140px;\" /\u003e\n\n# BHMSMAfMRI: Bayesian Hierarchical Multi-Subject Multiscale Analysis of fMRI Data\n\n\u003c!-- badges: start --\u003e\n\n[![CRAN\nstatus](https://www.r-pkg.org/badges/version/BHMSMAfMRI)](https://CRAN.R-project.org/package=BHMSMAfMRI)\n[![R-CMD-check](https://github.com/nilotpalsanyal/BHMSMAfMRI/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nilotpalsanyal/BHMSMAfMRI/actions/workflows/R-CMD-check.yaml)\n[![CodeFactor](https://www.codefactor.io/repository/github/nilotpalsanyal/bhmsmafmri/badge)](https://www.codefactor.io/repository/github/nilotpalsanyal/bhmsmafmri)\n[![](http://cranlogs.r-pkg.org/badges/grand-total/BHMSMAfMRI)](https://cran.r-project.org/package=BHMSMAfMRI)\n\u003c!-- badges: end --\u003e\n\nBHMSMAfMRI performs Bayesian hierarchical multi-subject multiscale\nanalysis of function MRI (fMRI) data as described in Sanyal \u0026 Ferreira\n([2012](#ref-paper)), or other multiscale data, using wavelet based\nprior that borrows strength across subjects and provides posterior\nsmooth estimates of the effect sizes and samples from their posterior\ndistribution.\n\n## Installation\n\n### Install from CRAN\n\n``` r\ninstall.packages(\"BHMSMAfMRI\")\n```\n\n### Install from GitHub\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"nilotpalsanyal/BHMSMAfMRI\")\n```\n\n## The main function:\n\nBHMSMA is the main function which accepts fMRI data as a 4D array (see\ncode below) and a design matrix. For the time-series of all voxels, a\ngeneral linear model (GLM) is fit with all the regressors in the design\nmatrix. After that, the standardized regression coefficient map of a\nregressor of interest is subjected to further analysis. The function\nBHMSMA returns the posterior smoothed map of the regression\ncoefficients. Below is a basic illustration of its use. For a detailed\nmanual, see the package\n\u003ca href=\"https://CRAN.R-project.org/package=BHMSMAfMRI\"\ntarget=\"_blank\"\u003evignette\u003c/a\u003e.\n\n``` r\nlibrary(BHMSMAfMRI)\n#\u003e \n#\u003e  Welcome! Thanks for trying BHMSMAfMRI.\n#\u003e  \n#\u003e  Website: https://nilotpalsanyal.github.io/BHMSMAfMRI/\n#\u003e  Bug report: https://github.com/nilotpalsanyal/BHMSMAfMRI/issues\n\n# Read data from image files\nfpath \u003c- system.file(\"extdata\", package=\"BHMSMAfMRI\")\nuntar(paste0(fpath,\"/fmridata.tar\"), exdir=tempdir())\nn \u003c- 3\ngrid \u003c- 32\nntime \u003c- 9\ndata \u003c- array(dim=c(n,grid,grid,ntime))\nfor(subject in 1:n)\n{\n  directory \u003c- paste0(tempdir(),\"/fmridata\",\"/s0\",subject,\"/\")\n  a \u003c- readfmridata(directory, format=\"Analyze\", prefix=paste0(\"s0\",subject,\"_t\"),\n                    nimages=9, dim.image=c(grid,grid,1))\n  data[subject,,,] \u003c- a[,,1,]\n}\ndata(fmridata)\nnames(fmridata)\n#\u003e [1] \"grid\"         \"nsubject\"     \"TrueCoeff\"    \"DesignMatrix\"\ntruecoef \u003c- fmridata$TrueCoeff\ndesignmat \u003c- fmridata$DesignMatrix\n\n# Perform analyses\nk \u003c- 2  #consider the second regressor\nanalysis \u003c- \"multi\"     #perform multi-subject analysis (MSA)\nBHMSMAmulti \u003c- BHMSMA(n, grid, data, designmat, k, analysis, truecoef)\nanalysis \u003c- \"single\"     #perform single subject analysis (SSA)\nBHMSMAsingle \u003c- BHMSMA(n, grid, data, designmat, k, analysis, truecoef)\n\n# Compare results for the first subject\nzlim = c(0,max(abs(BHMSMAmulti$GLMCoefStandardized[1,,,k])))\npar(mfrow=c(2,2))\nimage( truecoef[1,,],col=heat.colors(12),main=\"true map\")\nimage( abs(BHMSMAsingle$GLMCoefStandardized[1,,,k]),\n       col=heat.colors(8),zlim=zlim,main=\"GLM coef map\")\nimage( abs(BHMSMAsingle$GLMcoefposterior[1,,]),\n       col=heat.colors(8),zlim=zlim,main=\"posterior map SSA\")\nimage( abs(BHMSMAmulti$GLMcoefposterior[1,,]),\n       col=heat.colors(8),zlim=zlim,main=\"posterior map MSA\")\n```\n\n\u003cimg src=\"man/figures/README-example-1.png\" width=\"100%\" /\u003e\n\n## References:\n\n\u003cdiv id=\"refs\" class=\"references\"\u003e\n\n\u003cdiv id=\"ref-paper\"\u003e\n\nSanyal, Nilotpal, and Ferreira, Marco A.R. (2012). Bayesian hierarchical\nmulti-subject multiscale analysis of functional MRI data. Neuroimage,\n63, 3, 1519-1531. \u003cspan\ntarget=\"_blank\"\u003e\u003chttps://doi.org/10.1016/j.neuroimage.2012.08.041\u003e\u003c/span\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilotpalsanyal%2Fbhmsmafmri","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilotpalsanyal%2Fbhmsmafmri","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilotpalsanyal%2Fbhmsmafmri/lists"}