computing mean and mmd statistics and plotting