autohrf
1.1.3Automated Generation of Data-Informed GLM Models in Task-Based fMRI Data Analysis
Overview
Analysis of task-related functional magnetic resonance imaging (fMRI) activity at the level of individual participants is commonly based on general linear modelling (GLM) that allows us to estimate to what extent the blood oxygenation level dependent (BOLD) signal can be explained by task response predictors specified in the GLM model. The predictors are constructed by convolving the hypothesised timecourse of neural activity with an assumed hemodynamic response function (HRF). To get valid and precise estimates of task response, it is important to construct a model of neural activity that best matches actual neuronal activity. The construction of models is most often driven by predefined assumptions on the components of brain activity and their duration based on the task design and specific aims of the study. However, our assumptions about the onset and duration of component processes might be wrong and can also differ across brain regions. This can result in inappropriate or suboptimal models, bad fitting of the model to the actual data and invalid estimations of brain activity. Here we present an approach in which theoretically driven models of task response are used to define constraints based on which the final model is derived computationally using the actual data. Specifically, we developed 'autohrf' — a package for the 'R' programming language that allows for data-driven estimation of HRF models. The package uses genetic algorithms to efficiently search for models that fit the underlying data well. The package uses automated parameter search to find the onset and duration of task predictors which result in the highest fitness of the resulting GLM based on the fMRI signal under predefined restrictions. We evaluate the usefulness of the 'autohrf' package on publicly available datasets of task-related fMRI activity. Our results suggest that by using 'autohrf' users can find better task related brain activity models in a quick and efficient manner.
Install
Health
- OK2026-06-0913 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE
- ERROR2026-06-0812 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE
- OK2026-03-1014 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE
Documentation
- Examples that run
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- References docs
- 0%
Downloads
Repository
Stars over time
Issues over time
Repository practices
3 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/demsarjure/autohrf on 2026-07-19.
Dependencies
Nothing depends on this yet.
Code & Tests
- Cyclomatic complexity
- 4.0 median / 15 max
- Test cases
- 15 / 0.15 per code line
Test coverage
Line coverage
89%
Expression
89.2%
Tests / Examples
89.5% / 82% ex
Functions
18 18 exported
Complexity
4.5 avg / 15 max
Call network
18 nodes / 15 edges
Call graph
Open call graph →Lowest coverage
18 functions| Function | Cyclo | Coverage |
|---|---|---|
| plot_fitness exp | 2 | 0% |
| plot_best_models exp | 6 | 75% |
| convolve_events exp | 4 | 82% |
| downsample exp | 4 | 83% |
| fit_to_constraints exp | 15 | 85% |
| plot_model exp | 9 | 85% |
Datasets
People & History
5 releases. Pick two to compare their code metrics. R releases are shown for context.
Package metadata
- First published
- 2022-07-21
- Total releases
- 5 / 4 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 100 KB / 6 files
- Download size
- 2.0 MB
- Installed size
- not tracked yet
- With dependencies
- not tracked yet