I want to fit a linear regression model to evaluate how the impact of an event on the dependent variable is influenced by the hour, day, and month of occurrence.

My plan of action is to apply one hot encoding to each of these three variables, creating a total of 43 features that will be used to fit the LR model (12 for each month, 7 for each week, 24 for each hour).

Having fit the model, I can then determine which of these features are significant, whether they have a negative/positive influence on the dependent variable, and rank them in order of the magnitude of their influence.

My questions are then as follows:

Does this seem like a sensible approach to those more experienced with such methods?

Will splitting each variable (hour, day, month) into so many granular categories be an issue due to the limited number of observations for each category?

Any input or advice on the above would be invaluable to my process.

  • $\begingroup$ What is your target? Prediction? $\endgroup$ – Stephan Kolassa Nov 30 '17 at 16:42
  • $\begingroup$ The primary aim is to determine whether the event occurring on a particular day/week/month influences the dependent variable, and if so identify which days/weeks/months of occurrence result in the largest positive influence on the dependent variable. Prediction is a secondary objective. $\endgroup$ – RDG Nov 30 '17 at 22:09

I think this is reasonable. But you introduce a lot of new variables on the table by assuming completely independent variables for hour 1 and hour 2, and march and april, while it is reasonable to expect they are close. To reduce that effect, you can use seasonal / cyclic splines, or, a bit more advanced, gaussian processes. Both terms are googleable. I would start with the cyclic splines. Gaussian processes are what's used for the famous cover of Bayesian Data Analysis.

The use of p-values to decide on the influence is questionable. In general, but specifically here as well, because of the loose model specification in the sense above. If, for example, a specific variable is not significant, that says more about the number of observations you have than about the effect size. I advice to use rstanarm or some other bayesian regression package and report and use full posterior densities. Or, if you prefer, at least report point estimates and confidence intervals. It is a bad idea to just remove a coefficient that has plausible large effect sizes, but is hard to estimate, making it "not significant".

  • 1
    $\begingroup$ Thank you for the valuable input. Gaussian processes sound like an interesting approach. However I have a limited time frame to complete the project, which limits the extent of methods I can experiment with! $\endgroup$ – RDG Nov 30 '17 at 22:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.