The data could be found here:http://archive.ics.uci.edu/ml/datasets/Wine+Quality and the goal of such a data is to model wine, red wine particualrly,quality based on physicochemical tests. and In my analysis, I have choosen to build related models with one of the elements ,residual.sugar.

library(fpp2)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## ── Attaching packages ──────────────────────────────────────────────────── fpp2 2.4 ──
## ✓ ggplot2   3.3.2     ✓ fma       2.4  
## ✓ forecast  8.13      ✓ expsmooth 2.3
## 
library(knitr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
redwine = read.csv("~/Desktop/winequality-red.csv", sep=";")

redwine.ts = ts(redwine[,4], start=c(2000,01,01), end =c(2020,01,01),frequency = 12)


autoplot(redwine.ts, ylab = "Residual.Sugar ", main = "Reidual Sugar Index for Red Winde Quality check")

redwine.train = window(redwine.ts,start=c(2000),frequency=12)
redwine.test = window(redwine.ts,start=c(2020,01),frequency=12)

mean(redwine.train)
## [1] 2.339419
mean(redwine.test)
## [1] 1.7
redwine.ts.stl = stl(redwine.ts,s.window = "periodic")
redwine.seasonal = seasadj(redwine.ts.stl)

ggseasonplot(redwine.seasonal)

autoplot(redwine.seasonal)

#ETS Model

redwine.ets = ets(redwine.seasonal)
f1 = forecast(redwine.ets, h=6)
checkresiduals(f1)

## 
##  Ljung-Box test
## 
## data:  Residuals from ETS(M,N,M)
## Q* = 47.665, df = 10, p-value = 7.145e-07
## 
## Model df: 14.   Total lags used: 24
autoplot(f1)

#arima
redwine.arima = auto.arima(redwine.seasonal, seasonal=FALSE)
f2 = forecast(redwine.arima, h=6)
checkresiduals(f2)

## 
##  Ljung-Box test
## 
## data:  Residuals from ARIMA(1,0,0) with non-zero mean
## Q* = 52.634, df = 22, p-value = 0.0002554
## 
## Model df: 2.   Total lags used: 24
autoplot(f2)

accuracy(f1)
##                      ME     RMSE       MAE       MPE     MAPE      MASE
## Training set -0.0747041 1.192171 0.7656776 -14.91611 33.66055 0.8166752
##                   ACF1
## Training set 0.1506402
accuracy(f2)
##                        ME     RMSE       MAE       MPE     MAPE      MASE
## Training set 0.0005178853 1.084914 0.6357676 -12.33644 26.05313 0.6781126
##                     ACF1
## Training set -0.02357532