Quantitative psychology

A longitudinal study examines whether daily pain predicts next-day activity. Medication use changes over time, reduces pain, and also directly affects activity. Why must medication use be considered carefully in the analysis?