group analysis script (a kind of)