Hi!

I am currently working on a research project aiming at evaluating the effect of a speed-limit reduction on air pollution, using Regression Discontinuity in Time design. In this respect, I have four questions.

First, I would to know how I could condense my data. Indeed, I have average hourly pollution in logs for 6 pollutants between 01/10/2011 and 01/10/2017. I would like to keep these hourly averages, but aggregating them at the weekly level, or maybe at the monthly level. How can I do that?

Second, I have to include control variables in my model. I have chosen five weather variables: temperature, humidity, precipitation, snowfall, and windspeed. I have data per hour for these five variables, for the time window aforementionned. I would like to include current and 1-hour lags of quartics in these five variables. How can I generate such variables?

Third, I would like to include fixed effects in my regressions. More precisely, I would like to include: hours fixed effects, days fixed effects, hours x days fixed effects, hours x weekdays fixed effects, hours x weekends fixed effects, month fixed effects, and holidays fixed effects. I already have a variable, denoted DateTime, that has the format %-tcMonth_dd,_CCYY_HH:MM:SS.
How can I generate variables for hours (1 to 24), days (Monday to Sunday), weekdays (Monday to Friday), weekends (Saturday and Sunday), months (January to December), and holidays (to be determined) from my DateTime variable in order to include these fixed effects in my model?

Finally, I would like to have heteroskedasticity-robust standard errors with correlation within 5-week groups. How can I do such a thing on Stata?

I sincerely thank you all!

Best,

Guillaume