adding av.c - calculate averages for statistical sample