Loading the packages

library(forecast)
library(knitr)

Reading the data

wines <- read.csv(file="AustralianWines.csv")

Excluding the missing data.

wines <- na.omit(wines)

Data partitioning

Data partitioning for red wine

redwine.ts <- ts(wines$Red, start=c(1980,1), end=c(1994,12), frequency = 12)
time <- time(redwine.ts)
n.valid <- 2
n.train <- length(redwine.ts) - n.valid
redwine.train.ts <- window(redwine.ts, start=time[1], end=time[n.train])
redwine.valid.ts <- window(redwine.ts, start=time[n.train+1], end=time[n.train+n.valid])

Data partitioning for rose wine

rosewine.ts <- ts(wines$Rose, start=c(1980,1), end=c(1994,12), frequency = 12)
time <- time(rosewine.ts)
n.valid <- 2
n.train <- length(rosewine.ts) - n.valid
rosewine.train.ts <- window(rosewine.ts, start=time[1], end=time[n.train])
rosewine.valid.ts <- window(rosewine.ts, start=time[n.train+1], end=time[n.train+n.valid])

Naive method

The R package forecast has the function naive and snaive which can be used to generate forecasting using naive and seasonal naive methods respectively. We are going to generate naive and seasonal naive forecasts for red and rose wine in the validation data.

Naive forecast for the validation period in red wine

naive.red <- naive(redwine.train.ts, h=2)
naive.red$mean
##       Nov  Dec
## 1994 2226 2226

Seasonal naive method for the validation period in red wine

snaive.red <- snaive(redwine.train.ts, h=2)
snaive.red$mean
##       Nov  Dec
## 1994 2374 2535

Naive forecast for the validation period in rose wine

naive.rose <- naive(rosewine.train.ts, h=2)
naive.rose$mean
##      Nov Dec
## 1994  57  57

Seasonal naive method for the validation period in rose wine

snaive.rose <- snaive(rosewine.train.ts, h=2)
snaive.rose$mean
##      Nov Dec
## 1994  56  78

Comparing naive and seasonal naive forecast

Red wine

indexs <- c(2,3,5) ## Only RMSE, MAE, and MAPE.
acc.naive.red <- accuracy(naive.red, redwine.valid.ts)
acc.naive.red <- acc.naive.red[, indexs]
kable(acc.naive.red)
RMSE MAE MAPE
Training set 447.4490 312.0904 22.61781
Test set 411.9248 409.0000 15.49260
acc.seasonal.naive.red <- accuracy(snaive.red, redwine.valid.ts) 
acc.seasonal.naive.red <- acc.seasonal.naive.red[, indexs]
kable(acc.seasonal.naive.red)
RMSE MAE MAPE
Training set 271.6625 206.2771 12.327351
Test set 183.2280 180.5000 6.874702

The tables above show that the seasonal naive method performs better than the simple naive method.

plot(redwine.ts,  main="Forecast for monthly red wine sales", xlab="Time", ylab="Thousand of liters")

lines(naive.red$mean, col=4)

lines(snaive.red$mean, col=2)

legend("topright", lty=1, col=c(4,2), 
       legend=c("Naive method", "Seasonal naive method"))

The graph above shows two forecast method applied to the red wine sales data in the period of November and December of 1994. It is clear that the seasonal naive method fits better to the validation data.

Rose wine

indexs <- c(2,3,5) ## Only RMSE, MAE, and MAPE.
acc.naive.rose <- accuracy(naive.rose, rosewine.valid.ts)
acc.naive.rose <- acc.naive.rose[, indexs]
kable(acc.naive.rose)
RMSE MAE MAPE
Training set 34.94224 22.98305 141.63404
Test set 19.69772 18.00000 23.12534
acc.seasonal.naive.rose <- accuracy(snaive.rose, rosewine.valid.ts) 
acc.seasonal.naive.rose <- acc.seasonal.naive.rose[, indexs]
kable(acc.seasonal.naive.rose)
RMSE MAE MAPE
Training set 32.573735 19.62651 141.3526
Test set 8.544004 8.00000 11.2210

The tables above show that the seasonal naive method performs better than the simple naive method.

plot(rosewine.ts,  main="Forecast for monthly rose wine sales", xlab="Time", ylab="Thousand of liters")

lines(naive.rose$mean, col=4)

lines(snaive.rose$mean, col=2)

legend("topright", lty=1, col=c(4,2), 
       legend=c("Naive method", "Seasonal naive method"))

The graph above shows two forecast method applied to the rose wine sales data in the period of November and December of 1994. As the previous graph, it is clear that the seasonal naive method fits better.

Conclusions

The following conclusions can be drawn: