build_design_mt

build_design_mt(ModelSpec, BinData)

BUILD_DESIGN_MT Construct a GLM design matrix from user-selected factors and interactions

Usage:

X = build_design_mt(ModelSpec, BinData)

Inputs:

ModelSpec : struct - model specification (BinarySelect, InteractSelect, …) – required BinData : struct - all binned data (sta, sop, phase, sp_hist, RW) – required

Outputs:

X : TxP double - design matrix (size depends on selected factors and interactions)

Notes

Factors have fixed order [SOphase, stage, SOpower, history]. SOP is rescaled internally by /5 and quadratic terms by /10 to improve numerical conditioning. Supported interactions: stage:SOphase, SOpower:SOphase, and combined stage:SOphase + stage:history. Accompanies Chen et al., PNAS 2025.

See also: specify_mdl, preprocessToDesignMatrix, ismember_interaction

∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿