Modeling Group Formation and Activity Patterns in Self-Organizing Collectives of Individuals