SOFTWARE

A selection of R packages I have developed. For other code and analysis scripts, see my GitHub profile.


afpca — Adaptive Functional Principal Component Analysis

An R package for estimating directions of variation in functional data that exhibit sharp changes in smoothness. afpca combines a fast, scalable adaptive scatterplot smoother with a probabilistic FPCA framework, allowing each functional principal component to be smoothed adaptively. This is particularly useful in settings such as neural recordings, where sharp post-stimulus transitions must be distinguished from smooth baseline behavior — settings where standard global-smoothness assumptions fail.

Install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("angelgar/afpca")

A quick visual tour. Below are example outputs from the package vignette. First, 20 simulated curves drawn from a mean function and two functional principal components with locally varying smoothness:

Simulated functional data with locally varying smoothness

The estimated mean function and the first two adaptively-smoothed functional principal components recovered by fpca.adapt() — note how the estimator preserves sharp post-onset transitions rather than over-smoothing them:

Estimated mean function and adaptively-smoothed functional principal components

And two examples of observed curves alongside their reconstructions from the estimated components:

Observed curves with adaptive FPCA reconstructions


voxel — Mass-Univariate Voxelwise Analysis of Imaging Data

An R package for mass-univariate voxelwise analysis of NIfTI medical-imaging data, supporting general linear and generalized additive model workflows at the voxel level.

Install from CRAN:

install.packages("voxel")

voxel package example output