{"id":28752019,"url":"https://github.com/bbuchsbaum/fmrilss","last_synced_at":"2025-07-06T16:05:46.732Z","repository":{"id":298359072,"uuid":"999569056","full_name":"bbuchsbaum/fmrilss","owner":"bbuchsbaum","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-10T17:47:06.000Z","size":2018,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-10T18:57:40.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","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/bbuchsbaum.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-10T13:00:14.000Z","updated_at":"2025-06-10T17:47:10.000Z","dependencies_parsed_at":"2025-06-10T18:57:48.320Z","dependency_job_id":"9348628f-08f1-4374-9d02-ee2c6c5d8f47","html_url":"https://github.com/bbuchsbaum/fmrilss","commit_stats":null,"previous_names":["bbuchsbaum/fmrilss"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bbuchsbaum/fmrilss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbuchsbaum%2Ffmrilss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbuchsbaum%2Ffmrilss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbuchsbaum%2Ffmrilss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbuchsbaum%2Ffmrilss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbuchsbaum","download_url":"https://codeload.github.com/bbuchsbaum/fmrilss/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbuchsbaum%2Ffmrilss/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263932017,"owners_count":23531707,"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","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":[],"created_at":"2025-06-16T23:08:10.280Z","updated_at":"2025-07-06T16:05:46.706Z","avatar_url":"https://github.com/bbuchsbaum.png","language":"R","readme":"# fmrilss\n\n[![R-CMD-check](https://github.com/bbuchsbaum/fmrilss/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bbuchsbaum/fmrilss/actions/workflows/R-CMD-check.yaml)\n\nLeast Squares Separate (LSS) Analysis for fMRI Data.\n\n## Overview\n\nThe `fmrilss` package provides an efficient and flexible implementation of the Least Squares Separate (LSS) method for fMRI analysis, as proposed by Mumford et al. (2012). This approach models each trial with a separate GLM, making it a powerful technique for multivariate pattern analysis (MVPA) and connectivity studies where trial-specific estimates are needed.\n\nThe package offers multiple backends, from a simple reference implementation to a highly optimized, parallel C++ engine, all accessible through a clean, unified interface.\n\n## Features\n\n- **Five Implementations**: Includes a highly optimized C++ version, an optimized R version, standard vectorized R and C++ versions, and a simple R loop for testing and validation.\n- **Parallel Processing**: The optimized C++ version uses OpenMP for multi-threaded execution to maximize performance on modern hardware.\n- **Flexible \u0026 Modern Interface**: A clean `lss(Y, X, Z, Nuisance)` signature that is powerful and intuitive.\n- **Nuisance Regression**: Built-in support for projecting out nuisance regressors (e.g., motion parameters, physiological noise) before the LSS analysis.\n- **CRAN-Compliant**: Built with portable configurations suitable for CRAN submission.\n\n## Installation\n\nYou can install the development version of `fmrilss` from GitHub with:\n\n```r\n# install.packages(\"devtools\")\ndevtools::install_github(\"bbuchsbaum/fmrilss\")\n```\n\n## Usage\n\nThe primary function is `lss()`, which takes your data `Y`, trial design `X`, experimental regressors `Z`, and optional nuisance regressors.\n\n```r\nlibrary(fmrilss)\n\n# 1. Generate synthetic data\nset.seed(123)\nn_timepoints \u003c- 120\nn_trials \u003c- 15\nn_voxels \u003c- 50\n\n# Trial design matrix (X): one column per trial\nX \u003c- matrix(0, n_timepoints, n_trials)\nonsets \u003c- seq(from = 5, to = n_timepoints - 10, length.out = n_trials)\nfor(i in 1:n_trials) {\n  X[onsets[i]:(onsets[i] + 4), i] \u003c- 1\n}\ncolnames(X) \u003c- paste0(\"Trial_\", 1:n_trials)\n\n# Experimental regressors (Z): intercept and condition-specific effects\n# These are experimental regressors we want to model and get beta estimates for,\n# but not trial-wise (e.g., condition differences, block effects)\nZ \u003c- cbind(Intercept = 1, LinearTrend = scale(1:n_timepoints, center = TRUE, scale = FALSE))\n\n# Nuisance regressors: e.g., 6 motion parameters\nNuisance \u003c- matrix(rnorm(n_timepoints * 6), n_timepoints, 6)\n\n# Data (Y): timepoints x voxels\n# (Simulate some effects for demonstration)\ntrue_betas \u003c- matrix(rnorm(n_trials * n_voxels, 0, 1.5), n_trials, n_voxels)\nY \u003c- Z %*% matrix(c(10, -0.2), 2, n_voxels) + \n     X %*% true_betas +\n     Nuisance %*% matrix(rnorm(6 * n_voxels, 0, 2), 6, n_voxels) +\n     matrix(rnorm(n_timepoints * n_voxels, 0, 0.8), n_timepoints, n_voxels)\ncolnames(Y) \u003c- paste0(\"Voxel_\", 1:n_voxels)\n\n\n# 2. Run LSS analysis\n\n# Example 1: Basic LSS with default intercept\n# If Z is NULL, an intercept is automatically added.\nbeta_estimates \u003c- lss(Y, X)\n\n# Example 2: LSS with experimental regressors (intercept + condition effects)\nbeta_fixed \u003c- lss(Y, X, Z = Z)\n\n# Example 3: LSS with experimental regressors and nuisance regression\nbeta_clean \u003c- lss(Y, X, Z = Z, Nuisance = Nuisance)\n\n# Example 4: Use the super-fast, parallelized C++ implementation\nbeta_fast \u003c- lss(Y, X, Z = Z, Nuisance = Nuisance, method = \"cpp_optimized\")\n\n# The result is a (trials x voxels) matrix of beta estimates\nprint(dim(beta_fast))\n#\u003e [1] 15 50\nprint(beta_fast[1:5, 1:4])\n```\n\n## References\n\nMumford, J. A., Turner, B. O., Ashby, F. G., \u0026 Poldrack, R. A. (2012). Deconvolving BOLD activation in event-related designs for multivoxel pattern classification analyses. *NeuroImage*, 59(3), 2636-2643.\n\n## License\n\nGPL-3 ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbuchsbaum%2Ffmrilss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbuchsbaum%2Ffmrilss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbuchsbaum%2Ffmrilss/lists"}