MATLAB: Do Regressions every 12 periods

periodsregressiontime series

Hi! How can I do regressions for a time series data every 12 periods? I mean, I have monthly data and i would like to do a regression for each 12 months, corresponding to a regression every year. Does anyone know how to do this? Thank you.

Best Answer

If your data are in a vector, use reshape to create an (Nx12) matrix from it, then do the regressions on the rows.