1
$\begingroup$

I have a series of daily temperatures and have fitted a model using the function dlmModTrig of the package dlm in R which uses trigonometric functions which is ok. However I would like to try the other alternative which is the function dlmModSeas which uses s - 1 parameters for s seasons in a year.

My question is, since I have daily would I need 12 - 1 parameters in order to capture a monthly seasonal component or would be 30 - 1? anyhow it's a large number of parameters...

In addition, what if I would like to capture different frequencies? shall I fit a model for each frequency and add them up?

$\endgroup$
2
$\begingroup$

Using dummies, you would need 30, or 31, or 28, or 29 (leap years) parameters minus 1; 30 -1 would be a compromise. I would stay with dlmModTrig.

Regarding your second question, yes, you would fit a model for each frequency and add them up, where "add" is taken in the sense of dlm "add" operator.

$\endgroup$
  • 1
    $\begingroup$ Monthly seasonality of daily data still needs only 11 dummies. E.g. in January all dummies would be zeros every day, in February the first dummy would be 1, and others zeros etc. $\endgroup$ – Aksakal May 13 '14 at 17:28
  • $\begingroup$ I understood that "monthly seasonality" refers to a cycle which repeats itself every month. $\endgroup$ – F. Tusell May 14 '14 at 7:28
  • $\begingroup$ @F. Tusell since they are temperatures I assume they change from one month to the next and repeat the cycle every year but since I didn't want to boost the number of parameters I decided a monthly seasonal component. $\endgroup$ – nopeva May 14 '14 at 9:43
  • $\begingroup$ @AP13, OK, makes sense, I neglected the fact that data are temperatures, which renders my interpretation unplausible. Then either what you propose or 365-1 dummies are required. I think the use of dlmModTrig instead of dlmModSeas is much more convenient in this case. $\endgroup$ – F. Tusell May 14 '14 at 11:46
1
$\begingroup$

I'm not familiar with these function, but will comment on general considerations.

For monthly seasonality with dummies, you'll need 11 dummies regardless of the frequency of your data. If it's daily data or weekly, you'll still have the same 11 dummies.

For fitting into different frequencies I doubt that you can fit separately and add the frequencies. You can do something like that if you first filter out the frequencies, for instance, you could use a band pass filter to extract low and high bands of your series, then fit them separately. Since, the extracted series are orthogonal, this can be done.

$\endgroup$
  • $\begingroup$ thanks for your answer. Is this for a DLM model? it's a bit difficult for me to figure out how the seasonality would be included in the system equation. For a quarterly seasonality with monthly time series is easy since the constant matrix in the system equation would be of the form G <- diag(4); G <- rbind( G[4,] , G[1:3,] ) but when having daily data what would be the size of the matrix? it would be huge I guess... $\endgroup$ – nopeva May 14 '14 at 15:00
  • $\begingroup$ I looked at the R package docs. It's written very poorly, which is not surprising for R. I couldn't understand anything from reading the document. I'd have to look at more examples of calling or the code to understand how to call it. $\endgroup$ – Aksakal May 14 '14 at 15:15
  • $\begingroup$ What's not clear is how to set the unit of time. In their only example in documentation, they set frequency to 4 for quarterly seasonality. This means that the unit of time is 1 year, and that the observations come in 12 frequency. This means that you have to figure out how to tell this function to set the observation frequency to 365, then set the seasonal frequency to 12. It's a mystery to me how to accomplish this. $\endgroup$ – Aksakal May 14 '14 at 15:22

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.