generalized cohort function