I am using Ljung-box test after fitting an ARIMA model to a time series to investigate whether residuals do look like white noise or not. For this purpose I need to define the degree of freedom in the ljung_box function in R. I am not sure how we extract the number of parameters, is the sum of p, q and the Seasonal P & Q in case we have a seasonal ARIMA model?
As an example imagine we have a regression model with ARIMA errors like this:
fit <- vic_elec_daily %>%
model(ARIMA(Demand ~ Temperature + I(Temperature^2) +
(Day_Type == "Weekday")))
Resulting in:
fit
A mable: 1 x 1
ARIMA(Demand ~ Temperature + I(Temperature^2) + (Day_Type == \n "Weekday"))
<model>
1 <LM w/ ARIMA(2,1,2)(2,0,0)[7] errors>
The degree of the freedom specified by the Dr. Hyndman is 9 in this case but I am not sure how one should do it.
Any help is appreciated in advance.
m - p - qwithmbeing the seasonal period in my case is 7. However, we also have seasonalPandQso I am a bit confused here. – Anoushiravan R Apr 18 '22 at 16:13