0

I have a problem with my data. I want to have a dummy variable to indicate the week number in the year as a predictor. When I look into it, it seems that I need to have 51 dummy variables, and my results become strange when running the code in R. How can I add dummy variables to indicate the week of year for linear regression as a predictor? And is that a good idea?

I have tried to do this in R, but my results become somewhat wrong.

  • 1
    If you need advice on modeling your data, you should ask for help at [stats.se] instead where statistical questions are on topic. You are likely to get better help there. This is not really a specific programming question that's appropriate for Stack Overflow. Or at the very least share a reproducible example with sample input and the code you tried that can be used to test and verify possible solutions. We currently have no idea exactly what you tried. – MrFlick Mar 13 '24 at 14:40
  • 52 weeks per year is very similar to 24 hours per day. The duplicate should answer your question. Good luck! – Stephan Kolassa Mar 13 '24 at 14:57

0 Answers0