create score_historical function