I've got two time-series, S (stress in a railway track) and T (temperature). The time-series are several months long. The relationship is linear, however, it can change subtly or 'jump' at some points, due to work done on the rails.
Currently, I'm doing linear regression on a per-day basis, and then temperature-correcting S based on that days models. However, changes in the relationship do happen within each day, so this is not perfect.
I guess I'm trying to figure out how to best fit multiple linear models between S/T over time. How would I go about doing that? I've just started out with R, though I'm also good with Python.
lm (S ~ T, data=X)
where X is the data for one day? And the relationship between S and T changes at irregular intervals because of repair work and also changes throughout each day? The changes that take place during the day are due to what? (That is, the temperature changes during the day, but what else affects it? Precipitation, who-knows-what, rail traffic?) If you know what causes the changes within each day, you may be able to add that to your model. Knowing some more details would help shape an answer. $\endgroup$