2

I'm trying to create a simple regression model from time to outside temperature. Obviously there will be some relationship since it is colder at night than during the days (mostly anyways), only how can I make this model?

The time of the day is in hours and runs from 0 to 23, but obviously 23:00 is very near to 0:00 but not when looking at the difference in numbers. How can I change the time notation to reflect actual time difference? So 22 hours and 19 hours have a difference of 22-19=3 hours, and 23 hours and 0 hours have a difference of 1, but when calculating the difference you get 23-0=23 which isn't correct. This will have a big influence on the regression model. We use modular arithmetic in daily life, but can you use it in a regression model? What do you suggest?

N.B. if you think a regression model won't work but an other statistical model will, that's also fine. I'm just looking for a model that measures the goodness of fit (like $R^2$) for time and temperature.

  • 2
    Sure. This is standard in many fields as circular, Fourier, periodic or trigonometric regression. In time is in hours, then start with sine of $\pi \text{ hours}/12$ and its cosine twin as predictors. http://www.stata-journal.com/sjpdf.html?articlenum=st0116 is an introductory tutorial review. – Nick Cox May 14 '16 at 09:05
  • Thanks a lot for the link, I read it completely and it's exactly what I needed – Héctor van den Boorn May 15 '16 at 13:24

0 Answers0