using regress to detrend