Demo code and sample data for the two-stage generalized linear model in manuscript "Endogenous activity modulates stimulus and circuit-specific neural tuning and predicts perceptual behavior" by Yuanning Li et al. https://www.biorxiv.org/content/10.1101/687152v1
Written in MATLAB and R (tested on MacOS 10.14.6, MATLAB R2018b, R 3.5.2). Required R package: grpreg
To run the code: matlab main_cv.m