1. A database system for analyzing longitudinal data for a plurality of entities, the longitudinal data including events of a plurality of types and dates on which the events occurred with respect to the entity, the database system comprising: a storage system comprising one or more computer storage media, the storage system storing the longitudinal data and including an index mapping events to entities; a query engine having an input for receiving a query definition, and accessing the storage system to identify entities having events that match the query definition, such matching entities comprising a cohort, and computing measures for the entities that match the query definition; and an analytical engine having an input for receiving identifiers of the entities that match the query definition, and accessing the storage system to access data about events for the entities that match the query definition and the generated measures for those entities, and an output providing results of a statistical analysis performed on the cohort.