A quantitative analysis of home advantage in top football and basketball leagues