contrast_rsa_plan_phase2.md

Contrast RSA / MS-ReVE Phase 2 Implementation Plan

This document outlines the features and refinements to be added to the contrast_rsa_model functionality based on the original proposal (signed_rsa_proposal.md) and the current implementation state.

Keep things modular and simple! No God functions! No functions more than 100 lines!

always check off checkboxes when done

Core Engine Enhancements (Section C of Proposal)

Voxel-Level Refinements (Section D of Proposal)

Additional Output Maps (Section E of Proposal)

Documentation & Examples

Refactoring & Code Quality

Appendix: Context on Interaction Effects (Section F)

Why Interactions Matter in RSA: Main effect contrasts test simple geometric predictions (e.g., animate vs. inanimate separation). Interactions test if the geometry has extra structure beyond the sum of main effects.

Construction: An interaction contrast column (c_inter) is the element-wise product (⊙) of two centered main effect columns (c_p, c_q): c_inter = c_p ⊙ c_q.

Interaction RDM: The model RDM for the interaction (R_inter = c_inter %*% t(c_inter)) predicts similarity (+1) for condition pairs sharing the same interaction sign (e.g., both are [+p, +q] or both are [-p, -q]) and dissimilarity (-1) for pairs differing in interaction sign (e.g., [+p, +q] vs. [+p, -q]). This captures a pattern orthogonal to both main effect RDMs.

Orthogonalization: It's crucial to orthogonalize the full contrast matrix C_exp = [C_main | C_inter] (e.g., using rMVPA::contrasts(..., orth=TRUE) or rMVPA::orthogonalize_contrasts()). This ensures that the regression coefficient β_inter reflects variance uniquely explained by the interaction term after accounting for main effects.

Interpretation: - Δ_inter,v = t(U_hat) %*% c_tilde_inter: Voxel v's projection onto the orthogonalized interaction contrast. - β_inter * Δ_inter,v: How strongly voxel v contributes uniquely to the interaction pattern. - Example: A voxel might respond strongly only to "animate-small" conditions, contributing positively to an animacy-by-size interaction, even if its response to animacy or size alone isn't distinct.

Workflow: Define interactions in the spec for rMVPA::contrasts(), ensure orth=TRUE, then run contrast_rsa_model. The engine handles interaction columns like any other contrast.



bbuchsbaum/rMVPA documentation built on June 10, 2025, 8:23 p.m.