1
$\begingroup$

I'm working on a data set where I have a set of events per time of the day (in a 1h time slot). I made the sum of the events and plotted a bar as show below.

Bars plot for the number of events

In order to define an equation that could give me the chance chance of the event to happen according to the time of the day, I did a polynomial regression for each of the 3 data sets (Total, Streets and Streets+GIS).

scatter plot + polynomial regressions

As the time of the day is a cycle, I'd like to see the regression connecting the data point at the end of the graph (23h) to the beginning of it (0h). That is, I would like to run a regression analysis and find the parameters that best fit for my data but without losing the continuity of the time of the day.

I've searched for circular regression analysis, but so far didn't succeed in finding any appropriate material for a non-statistician who programs in python. Would someone mind giving me a hint about what can I do, or so good material from where I can learn how to make this sort of analysis?

$\endgroup$
  • $\begingroup$ regress on sine and cosine (2 x pi x f x t/24) with f = [1,2,3,...] $\endgroup$ – seanv507 May 30 at 12:37
  • $\begingroup$ See our posts on circular splines. $\endgroup$ – whuber May 30 at 13:08
  • $\begingroup$ @seanv507 I will try it... thanks. $\endgroup$ – Eric Araújo May 30 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.