In order do make a regression for daily sales data i need to set up different dummies (e.g. day of the week, monthly, yearly, week of the year, moving holidays...)
dummies <- cbind(model.matrix(~template$Weekday)[,2:7], model.matrix(~as.factor(template$Month))[,2:12], model.matrix(~as.factor(template$Year))[,2:5], model.matrix(~as.factor(template$CalendarWeek))[,2:53]) colnames(dummies) <- c('Tue','Wed','Thu','Fri','Sat','Sun', 'Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec', paste0('y',rep(2:5)), #5 years of data in total paste0('w',rep(2:53))) #calendar weeks
"template" is a data.table which includes all the information (e.g. Sales, Date, Weekday...)
Right now i am missing holiday dummies (including lead & lag dummies). In order to catch the moving holidays i have to create one dummy per holiday.
How do i figure out how many lead and lag dummies i need for different holidays? Is there a way to create them "on the fly" meaning i start adding lead/lag variables step by step (e.g. first: Easter-1, second: Easter-2...) and check each time if my regression model improves (e.g. AIC goes down)?
How do i deal with not-moving holidays? Simply creating dummy variables for "day of the year"? E.g. 366 dummy variables
Are there any kind of dummy variables missing so far? E.g. day of the month?
Thanks for your support!