Skip to contents

Getting Started with HATSA

HATSA (Hyperalignment via Task-informed Shared Analysis) provides state-of-the-art methods for aligning functional brain data across subjects. This guide will get you started quickly.

Installation

# Install from GitHub
devtools::install_github("bbuchsbaum/hatsa")

Your First Alignment

The simplest way to use HATSA is with the hatsa() function:

# Assume you have a list of subject data matrices
# Each matrix is timepoints × voxels
result <- hatsa(subject_data)

# That's it! HATSA automatically:
# - Selects optimal anchors
# - Chooses appropriate parameters
# - Performs the alignment

Understanding Your Results

HATSA provides simple functions to explore your results:

# Get a quick summary
hatsa_summary(result)

# Extract aligned data
aligned_data <- get_aligned_data(result)

# Get the group template
template <- get_template(result)

# Visualize alignment quality
plot_hatsa(result, type = "eigenvalues")

Choosing Parameters

Not sure what parameters to use? Let HATSA help:

# Get suggestions based on your data
params <- hatsa_suggest(subject_data)

# Use the suggestions
result <- hatsa(subject_data, 
                components = params$components,
                preset = params$preset)

Task-Informed Alignment

If you have task information, HATSA can use it to improve alignment:

# Automatic method selection
result <- hatsa_task(subject_data, task_data)

# Or choose a specific method
result <- hatsa_task(subject_data, task_data, method = "blend")

Presets for Different Scenarios

HATSA includes presets optimized for different use cases:

# Fast mode for exploration
result_fast <- hatsa(subject_data, preset = "fast")

# Accurate mode for final analyses  
result_accurate <- hatsa(subject_data, preset = "accurate")

# Default balanced mode
result_default <- hatsa(subject_data, preset = "default")

Next Steps

Getting Help

# Built-in documentation
?hatsa
?hatsa_task

# Parameter validation
hatsa_validate_params(subject_data, 
                      anchor_indices = my_anchors,
                      spectral_rank_k = 30)