includes code for smooth time trend