prevalence function

Generic function to calculate prevalence from trajectory data