Daily maximum temperatures in Melbourne, Australia, 1981-1990 the data can be downloaded at the follow link: https://datamarket.com/data/set/2323/daily-maximum-temperatures-in-melbourne-australia-1981-1990#!ds=2323&display=line
hint: Some graphics are iterative, you can select a area to see it near.
We observe that our time-serie has no trend, but its clear that there is a seasonality. Therefore, lets adopt the follow model:
\(X_t = S_t + Z_t\) , where \(S_t\) is the seasonal component and \(Z_t\) is the stochastic component.
Adopting a non-parametric model for the seasonality, we have
\(\hat{\mu}_m = \frac{1}{n} \sum\limits_{r=1}^{n}X_{r,m}\), where \(n \in [1,...,10]\) and \(m \in [1,...,365]\)
In the code bellow, we applied this estimator for the seasonality of our time-serie.
#lendo os dados
data = read.csv("daily-maximum-temperatures-in-me.csv",sep=",",header=T)
aux = data
for(i in 1:365)
{
for(k in 1:9)
{
aux[i,2] = aux[i,2] + aux[i+(k*365),2]
}
}
aux[,2] = aux[,2]/10
sazo = rep(aux[1:365,2],10)
Therefore, we got the following estimation for the seasonal component.
extracting the seasonality, we have the following stochastic component \((Z_t)\).
Through the graphics of autocorrelation and patial autocorrelation we observe that a model might be the AR(2), but we are not so sure about this, the model coulbe another arima derivation with parameter two as well, because the graphics is not very clear.
So, we are going to select the model between the possible ones throughout the AIC and BIC, where smaller value means better model. Don’t forget that the residuals from a arima model have to be the kind white noise for the model be considered valid.
## Series: tsnosazo
## ARIMA(2,0,0) with non-zero mean
##
## Coefficients:
## ar1 ar2 intercept
## 0.5010 -0.1315 -0.0006
## s.e. 0.0164 0.0164 0.0958
##
## sigma^2 estimated as 13.32: log likelihood=-9904.05
## AIC=19816.1 AICc=19816.11 BIC=19840.91
## Series: tsnosazo
## ARIMA(0,0,2) with non-zero mean
##
## Coefficients:
## ma1 ma2 intercept
## 0.4981 0.1269 0.0002
## s.e. 0.0163 0.0167 0.0982
##
## sigma^2 estimated as 13.33: log likelihood=-9905.53
## AIC=19819.06 AICc=19819.07 BIC=19843.87
## Series: tsnosazo
## ARIMA(2,0,2) with non-zero mean
##
## Coefficients:
## ar1 ar2 ma1 ma2 intercept
## 0.5291 -0.1725 -0.0307 0.0362 -0.0007
## s.e. 0.1673 0.0547 0.1675 0.0551 0.0943
##
## sigma^2 estimated as 13.31: log likelihood=-9903.42
## AIC=19818.84 AICc=19818.86 BIC=19856.06
## Series: ts2
## ARIMA(2,1,2)
##
## Coefficients:
## ar1 ar2 ma1 ma2
## 0.8216 -0.3108 -1.2657 0.3334
## s.e. 0.0811 0.0349 0.0838 0.0776
##
## sigma^2 estimated as 15.54: log likelihood=-10184.27
## AIC=20378.54 AICc=20378.55 BIC=20409.55
From all models we observe that the residuals are not correlated, and also non-normal. However, the smaller AIC and BIC came from the AR(2) model,therefore it is the best model for the data.
Select on the graphic with your mouse(or your finger) the predicted values(blue values) to see they near.