modified hb_trend_sample