Problem Description

Build time series models in using GE Power Stock in the BSE.Our goal is to forecast the closing price of the GEPower for future time period using time series algorithms and evaluating each of the algorithms

clearing the environment

rm(list = ls(all = TRUE))

library call

library(Quandl)
## Loading required package: xts
## Warning: package 'xts' was built under R version 3.3.3
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 3.3.3
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(forecast)
library(lubridate)
## Warning: package 'lubridate' was built under R version 3.3.3
## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
## 
##     date
library(DataCombine)
## Warning: package 'DataCombine' was built under R version 3.3.3
library(imputeTS)
## Warning: package 'imputeTS' was built under R version 3.3.3
## 
## Attaching package: 'imputeTS'
## The following object is masked from 'package:zoo':
## 
##     na.locf
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.3.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:lubridate':
## 
##     intersect, setdiff, union
## The following objects are masked from 'package:xts':
## 
##     first, last
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(TTR)
## Warning: package 'TTR' was built under R version 3.3.3
library(graphics)
library(data.table)
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
## The following object is masked from 'package:DataCombine':
## 
##     shift
## The following objects are masked from 'package:lubridate':
## 
##     hour, isoweek, mday, minute, month, quarter, second, wday,
##     week, yday, year
## The following objects are masked from 'package:xts':
## 
##     first, last
library(plyr)
## Warning: package 'plyr' was built under R version 3.3.3
## -------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## -------------------------------------------------------------------------
## 
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following object is masked from 'package:lubridate':
## 
##     here
library(zoo)

Pulling the data from Quandl website and reading the data.

GE_data <-Quandl("BSE/BOM532309", api_key="Q2ek_939U_2zj-S9cMqN")

basic understanding of the data

names(GE_data)
##  [1] "Date"                      "Open"                     
##  [3] "High"                      "Low"                      
##  [5] "Close"                     "WAP"                      
##  [7] "No. of Shares"             "No. of Trades"            
##  [9] "Total Turnover"            "Deliverable Quantity"     
## [11] "% Deli. Qty to Traded Qty" "Spread H-L"               
## [13] "Spread C-O"
summary(GE_data)
##       Date                 Open             High             Low         
##  Min.   :2000-03-21   Min.   :  16.0   Min.   :  16.4   Min.   :  15.05  
##  1st Qu.:2004-09-09   1st Qu.: 134.0   1st Qu.: 137.0   1st Qu.: 131.34  
##  Median :2009-01-10   Median : 379.3   Median : 385.1   Median : 371.00  
##  Mean   :2009-01-03   Mean   : 377.9   Mean   : 385.4   Mean   : 370.09  
##  3rd Qu.:2013-05-09   3rd Qu.: 581.0   3rd Qu.: 590.0   3rd Qu.: 570.05  
##  Max.   :2017-08-11   Max.   :1099.0   Max.   :1109.0   Max.   :1060.00  
##                                                                          
##      Close              WAP          No. of Shares     No. of Trades  
##  Min.   :  15.75   Min.   :  15.93   Min.   :      1   Min.   :    1  
##  1st Qu.: 133.20   1st Qu.: 134.26   1st Qu.:   5166   1st Qu.:  193  
##  Median : 377.68   Median : 378.95   Median :  17924   Median :  603  
##  Mean   : 376.85   Mean   : 378.01   Mean   :  58081   Mean   : 1294  
##  3rd Qu.: 578.49   3rd Qu.: 580.31   3rd Qu.:  53533   3rd Qu.: 1466  
##  Max.   :1082.10   Max.   :1091.21   Max.   :3067625   Max.   :77660  
##                                                                       
##  Total Turnover      Deliverable Quantity % Deli. Qty to Traded Qty
##  Min.   :3.300e+01   Min.   :    39       Min.   :  1.57           
##  1st Qu.:1.173e+06   1st Qu.:  3036       1st Qu.: 31.64           
##  Median :5.139e+06   Median :  9088       Median : 45.30           
##  Mean   :2.220e+07   Mean   : 20992       Mean   : 47.45           
##  3rd Qu.:1.782e+07   3rd Qu.: 23432       3rd Qu.: 61.70           
##  Max.   :1.993e+09   Max.   :441337       Max.   :100.00           
##                      NA's   :444          NA's   :444              
##    Spread H-L       Spread C-O     
##  Min.   :  0.00   Min.   :-88.650  
##  1st Qu.:  5.40   1st Qu.: -5.250  
##  Median : 12.07   Median : -0.700  
##  Mean   : 15.29   Mean   : -1.088  
##  3rd Qu.: 20.25   3rd Qu.:  2.500  
##  Max.   :250.00   Max.   : 90.950  
## 
dim(GE_data)
## [1] 4162   13
length(GE_data)
## [1] 13
str(GE_data)
## 'data.frame':    4162 obs. of  13 variables:
##  $ Date                     : Date, format: "2017-08-11" "2017-08-10" ...
##  $ Open                     : num  650 675 685 704 710 ...
##  $ High                     : num  673 678 695 704 712 ...
##  $ Low                      : num  647 646 670 687 698 ...
##  $ Close                    : num  669 656 676 694 706 ...
##  $ WAP                      : num  659 662 683 696 705 ...
##  $ No. of Shares            : num  2079 2312 2128 479 2521 ...
##  $ No. of Trades            : num  110 166 104 43 155 97 77 220 750 220 ...
##  $ Total Turnover           : num  1369360 1530677 1452890 333396 1777251 ...
##  $ Deliverable Quantity     : num  1362 1461 1439 295 1796 ...
##  $ % Deli. Qty to Traded Qty: num  65.5 63.2 67.6 61.6 71.2 ...
##  $ Spread H-L               : num  26.4 31.5 24.9 17.4 14.1 ...
##  $ Spread C-O               : num  19.45 -18.7 -9.05 -9.7 -4 ...
##  - attr(*, "freq")= chr "daily"

basic data view

head(GE_data,30)
##          Date   Open   High    Low  Close    WAP No. of Shares
## 1  2017-08-11 650.00 673.35 646.90 669.45 658.66          2079
## 2  2017-08-10 674.95 677.85 646.35 656.25 662.06          2312
## 3  2017-08-09 685.10 695.05 670.10 676.05 682.75          2128
## 4  2017-08-08 704.00 704.00 686.60 694.30 696.03           479
## 5  2017-08-07 710.00 712.00 697.95 706.00 704.98          2521
## 6  2017-08-04 699.00 710.00 691.00 709.20 705.21          2537
## 7  2017-08-03 705.15 708.00 697.95 705.05 704.12          1804
## 8  2017-08-02 700.05 713.60 699.00 710.65 708.53          4491
## 9  2017-08-01 717.00 717.00 678.85 706.00 699.20          8257
## 10 2017-07-31 714.00 717.00 707.40 714.35 712.20          3870
## 11 2017-07-28 680.00 712.50 680.00 710.30 706.64         13180
## 12 2017-07-27 695.00 721.00 667.00 678.65 692.89          6484
## 13 2017-07-26 660.00 746.50 660.00 691.35 709.36         30980
## 14 2017-07-25 651.35 663.00 650.00 660.70 654.42          2397
## 15 2017-07-24 640.10 660.00 640.10 651.50 649.78           430
## 16 2017-07-21 645.05 655.00 644.95 648.95 649.04           757
## 17 2017-07-20 650.00 655.00 640.10 649.00 652.00          1490
## 18 2017-07-19 673.95 673.95 632.90 649.95 650.05          1249
## 19 2017-07-18 625.50 647.70 625.00 637.00 634.63          1354
## 20 2017-07-17 626.60 637.05 621.00 632.80 631.38          1699
## 21 2017-07-14 651.00 651.00 631.60 641.80 638.19          1239
## 22 2017-07-13 666.00 669.90 645.25 647.10 658.49          1722
## 23 2017-07-12 655.05 679.00 655.05 669.85 670.55          4912
## 24 2017-07-11 662.00 666.60 645.20 653.20 660.75          2218
## 25 2017-07-10 658.00 669.00 650.00 664.45 660.08          7645
## 26 2017-07-07 622.25 661.00 621.65 655.20 652.57          5552
## 27 2017-07-06 632.05 632.55 623.05 625.00 628.56           493
## 28 2017-07-05 624.00 641.70 623.80 630.30 630.95          1128
## 29 2017-07-04 628.00 630.85 617.00 620.20 621.21          1070
## 30 2017-07-03 615.05 634.00 615.05 632.15 628.37           146
##    No. of Trades Total Turnover Deliverable Quantity
## 1            110        1369360                 1362
## 2            166        1530677                 1461
## 3            104        1452890                 1439
## 4             43         333396                  295
## 5            155        1777251                 1796
## 6             97        1789108                 2213
## 7             77        1270228                 1338
## 8            220        3181986                 3136
## 9            750        5773259                 4596
## 10           220        2756203                 2308
## 11           637        9313504                 7115
## 12           487        4492699                 2307
## 13          2052       21975976                 9473
## 14           102        1568645                 1708
## 15            43         279406                  258
## 16            54         491322                  564
## 17            34         971477                 1446
## 18            76         811912                  826
## 19            77         859286                 1135
## 20            92        1072722                  880
## 21            58         790715                 1009
## 22           160        1133926                  998
## 23           157        3293741                 4199
## 24           120        1465554                 1458
## 25           244        5046322                 6572
## 26           236        3623058                 3228
## 27            23         309881                  306
## 28            77         711712                  596
## 29            42         664692                  679
## 30            25          91742                  128
##    % Deli. Qty to Traded Qty Spread H-L Spread C-O
## 1                      65.51      26.45      19.45
## 2                      63.19      31.50     -18.70
## 3                      67.62      24.95      -9.05
## 4                      61.59      17.40      -9.70
## 5                      71.24      14.05      -4.00
## 6                      87.23      19.00      10.20
## 7                      74.17      10.05      -0.10
## 8                      69.83      14.60      10.60
## 9                      55.66      38.15     -11.00
## 10                     59.64       9.60       0.35
## 11                     53.98      32.50      30.30
## 12                     35.58      54.00     -16.35
## 13                     30.58      86.50      31.35
## 14                     71.26      13.00       9.35
## 15                     60.00      19.90      11.40
## 16                     74.50      10.05       3.90
## 17                     97.05      14.90      -1.00
## 18                     66.13      41.05     -24.00
## 19                     83.83      22.70      11.50
## 20                     51.80      16.05       6.20
## 21                     81.44      19.40      -9.20
## 22                     57.96      24.65     -18.90
## 23                     85.48      23.95      14.80
## 24                     65.73      21.40      -8.80
## 25                     85.96      19.00       6.45
## 26                     58.14      39.35      32.95
## 27                     62.07       9.50      -7.05
## 28                     52.84      17.90       6.30
## 29                     63.46      13.85      -7.80
## 30                     87.67      18.95      17.10
tail(GE_data,30)
##            Date   Open   High    Low  Close       WAP No. of Shares
## 4133 2000-05-08  39.10  39.10  38.90  39.00  38.93077           650
## 4134 2000-05-05  36.25  42.50  36.25  36.25  37.30066         18100
## 4135 2000-05-04  39.40  39.40  39.40  39.40  39.40000           250
## 4136 2000-05-03  43.00  43.00  42.80  42.80  42.83333           300
## 4137 2000-04-28  46.50  46.50  46.50  46.50  46.50000            50
## 4138 2000-04-27  47.10  50.00  47.10  50.00  49.45875           800
## 4139 2000-04-26  54.00  54.00  49.15  50.30  50.25952          2100
## 4140 2000-04-25  56.50  56.50  53.40  53.40  53.98889           900
## 4141 2000-04-24  57.75  58.00  57.75  58.00  57.92500           600
## 4142 2000-04-20  55.50  56.05  55.50  55.50  55.70769           650
## 4143 2000-04-19  60.00  60.00  60.00  60.00  60.00000           100
## 4144 2000-04-18  58.50  61.00  56.65  57.00  57.14570         22100
## 4145 2000-04-17  61.60  61.60  61.55  61.55  61.57500           200
## 4146 2000-04-13  72.00  72.00  66.80  66.80  66.97222          2700
## 4147 2000-04-12  73.70  73.80  72.55  72.60  72.92701         11550
## 4148 2000-04-11  72.00  76.00  72.00  76.00  72.83471         17612
## 4149 2000-04-10  77.00  77.00  72.50  72.60  72.56287        102750
## 4150 2000-04-07  73.00  75.50  72.00  75.00  74.48571           350
## 4151 2000-04-06  71.75  74.90  70.00  72.65  71.56308          1300
## 4152 2000-04-05  67.50  72.00  65.25  72.00  68.21958          2400
## 4153 2000-04-04  72.45  72.45  67.00  67.00  68.11879          2315
## 4154 2000-04-03  67.10  67.10  67.10  67.10  67.10000          8200
## 4155 2000-03-31  62.00  69.25  62.00  62.15  63.14929          4200
## 4156 2000-03-29  74.10  76.95  73.15  73.20  74.53115         24400
## 4157 2000-03-28  78.70  83.90  78.70  79.50  79.49109         24700
## 4158 2000-03-27  95.00  95.00  85.50  85.50  91.41200          2250
## 4159 2000-03-24  92.70  93.00  92.70  92.90  92.83200          1250
## 4160 2000-03-23 100.75 100.75 100.75 100.75 100.75000           400
## 4161 2000-03-22 109.50 109.50 109.50 109.50 109.50000           600
## 4162 2000-03-21 111.00 119.00 101.00 119.00 108.38000           500
##      No. of Trades Total Turnover Deliverable Quantity
## 4133             3          25305                   NA
## 4134            56         675142                   NA
## 4135             2           9850                   NA
## 4136             3          12850                   NA
## 4137             1           2325                   NA
## 4138            10          39567                   NA
## 4139            20         105545                   NA
## 4140             6          48590                   NA
## 4141             6          34755                   NA
## 4142            11          36210                   NA
## 4143             1           6000                   NA
## 4144            66        1262920                   NA
## 4145             2          12315                   NA
## 4146            15         180825                   NA
## 4147            92         842307                   NA
## 4148            38        1282765                   NA
## 4149            49        7455835                   NA
## 4150             5          26070                   NA
## 4151            11          93032                   NA
## 4152            14         163727                   NA
## 4153            17         157695                   NA
## 4154             9         550220                   NA
## 4155            33         265227                   NA
## 4156           133        1818560                   NA
## 4157           118        1963430                   NA
## 4158             9         205677                   NA
## 4159            10         116040                   NA
## 4160             6          40300                   NA
## 4161             4          65700                   NA
## 4162             6          54190                   NA
##      % Deli. Qty to Traded Qty Spread H-L Spread C-O
## 4133                        NA       0.20      -0.10
## 4134                        NA       6.25       0.00
## 4135                        NA       0.00       0.00
## 4136                        NA       0.20      -0.20
## 4137                        NA       0.00       0.00
## 4138                        NA       2.90       2.90
## 4139                        NA       4.85      -3.70
## 4140                        NA       3.10      -3.10
## 4141                        NA       0.25       0.25
## 4142                        NA       0.55       0.00
## 4143                        NA       0.00       0.00
## 4144                        NA       4.35      -1.50
## 4145                        NA       0.05      -0.05
## 4146                        NA       5.20      -5.20
## 4147                        NA       1.25      -1.10
## 4148                        NA       4.00       4.00
## 4149                        NA       4.50      -4.40
## 4150                        NA       3.50       2.00
## 4151                        NA       4.90       0.90
## 4152                        NA       6.75       4.50
## 4153                        NA       5.45      -5.45
## 4154                        NA       0.00       0.00
## 4155                        NA       7.25       0.15
## 4156                        NA       3.80      -0.90
## 4157                        NA       5.20       0.80
## 4158                        NA       9.50      -9.50
## 4159                        NA       0.30       0.20
## 4160                        NA       0.00       0.00
## 4161                        NA       0.00       0.00
## 4162                        NA      18.00       8.00

Observation & Analysis

GE_data.Day = ddply(GE_data,.(Date),summarize,close_price = mean(Close))
GE_data.Day$Date=as.Date(GE_data.Day$Date,format="%Y-%m-%d")
minDate=min(as.Date(GE_data.Day$Date,format="%Y-%m-%d"))
maxDate =max(as.Date(GE_data.Day$Date,format="%Y-%m-%d"))

Creating a data frame for sequence of Days.

seq <- data.frame("dateRange"=seq(minDate,maxDate,by="days"))

Merge the data frames of seq of dates with the dates of sale.

GE_data1 = merge(seq,GE_data.Day,by.x = "dateRange",by.y = "Date",all.x = T)
head(GE_data1)
##    dateRange close_price
## 1 2000-03-21      119.00
## 2 2000-03-22      109.50
## 3 2000-03-23      100.75
## 4 2000-03-24       92.90
## 5 2000-03-25          NA
## 6 2000-03-26          NA

Impuation of Missing Values.

GE_data1$close_price<-na.locf(GE_data1$close_price)
head(GE_data1)
##    dateRange close_price
## 1 2000-03-21      119.00
## 2 2000-03-22      109.50
## 3 2000-03-23      100.75
## 4 2000-03-24       92.90
## 5 2000-03-25       92.90
## 6 2000-03-26       92.90

Observation on close_price on weekly basis.

GE_data1$WEEK <-as.numeric(format(GE_data1$dateRange,format="%Y.%W"))
GE_data1.Week<-ddply(GE_data1, .(WEEK),summarize,close_price=mean(close_price))
head(GE_data1.Week)
##      WEEK close_price
## 1 2000.12   101.32500
## 2 2000.13    71.12143
## 3 2000.14    71.96429
## 4 2000.15    69.77143
## 5 2000.16    57.22143
## 6 2000.17    50.17143

splitting of the data

Train=GE_data1.Week[which(GE_data1.Week$WEEK<=2013.52),]
Test=GE_data1.Week[which(GE_data1.Week$WEEK>2013.52),]

converting into time series

Price <- ts(Train$close_price,frequency =52)

visualize the time series data

plot(Price,
     type="l",
     lwd=3,
     col="red",
     xlab="yearly",
     ylab="Price",
     main="Time series plot for Book-xyzabc")

Decomposed time series

Pricedecomposed=decompose(Price)
plot(Pricedecomposed,col="Red")

ACF,PACF

par(mfrow=c(2,2))
acf(Price,lag=30)
pacf(Price,lag=30)

Price1 <- ts(Train$close_price, frequency =1)
plot(Price1,xlab = "Weekly",ylab="Price")

acf(Price1,lag=30)

pacf(Price1,lag=30)

Stationarize by differencing & taking log transform

par(mfrow=c(2,3))
plot(diff(Price1,lag = 1),type="l"); acf(diff(Price1,lag = 1),lag=30) ;pacf(diff(Price1,lag = 1),lag=30)
plot(diff(Price1,lag=2),type="l");  acf(diff(Price1,lag = 2),lag=30); pacf(diff(Price1,lag = 2),lag=30)

plot(diff(log10(Price1),type="l"));acf(diff(log10(Price1),lag=30));pacf(diff(log10(Price1),lag=30))

ndiffs(Price)
## [1] 1

Modelling the time series using simple moving averages

fitsma <- SMA(Price,n=2)
pred<-forecast(fitsma,h=8)
## Warning in ets(object, lambda = lambda, allow.multiplicative.trend =
## allow.multiplicative.trend, : Missing values encountered. Using longest
## contiguous portion of time series
plot(pred)
lines(fitsma,col="red")

Define the metric MAPE

smaMape <- mean(abs((Price[2:length(Price)]-fitsma[2:length(Price)])/Price[2:length(Price)]))
smaMape
## [1] 0.02292155

Weighted Moving Averages

fitwma<- WMA(Price,n=2,1:2)
wmaMape <- mean(abs((Price[2:length(Price)]-fitwma[2:length(Price)])/Price[2:length(Price)]))
wmaMape
## [1] 0.01528103
pred<-forecast(fitwma,h=8)
## Warning in ets(object, lambda = lambda, allow.multiplicative.trend =
## allow.multiplicative.trend, : Missing values encountered. Using longest
## contiguous portion of time series
plot(pred)
lines(fitwma,col="yellow")

Exponential Moving Averages

fitEma <- EMA(Price, n = 2)
emaMape <- mean(abs((Price[2:length(Price)]-fitEma[2:length(Price)])/Price[2:length(Price)]))
emaMape
## [1] 0.01810755
pred<-forecast(fitEma,h=8)
## Warning in ets(object, lambda = lambda, allow.multiplicative.trend =
## allow.multiplicative.trend, : Missing values encountered. Using longest
## contiguous portion of time series
plot(pred)
lines(fitEma,col="purple")

Build a HoltWinters model with trend

holtpriceforecast <- HoltWinters(Train$close_price,gamma=FALSE)
head(holtpriceforecast$fitted)
## Time Series:
## Start = 3 
## End = 8 
## Frequency = 1 
##       xhat    level     trend
## 3 40.91786 71.12143 -30.20357
## 4 44.59372 71.96429 -27.37057
## 5 44.69834 69.77143 -25.07309
## 6 33.29108 57.22143 -23.93035
## 7 27.78142 50.17143 -22.39001
## 8 19.34072 40.56429 -21.22357

HoltWinters model with trend and Seasonality

priceholtforecast = HoltWinters(Price, beta=TRUE, gamma=TRUE, seasonal="additive")
head(priceholtforecast$fitted)
## Time Series:
## Start = c(2, 1) 
## End = c(2, 6) 
## Frequency = 52 
##              xhat    level     trend   season
## 2.000000 32.51193 27.52150 0.1115645 4.878858
## 2.019231 34.38084 28.29413 0.7726234 5.314091
## 2.038462 32.82178 28.51791 0.2237776 4.080094
## 2.057692 31.59478 28.71331 0.1954041 2.686069
## 2.076923 32.46066 28.92084 0.2075306 3.332292
## 2.096154 30.74751 29.15996 0.2391171 1.348432

Prediction on the Train

holtforecastTrain = data.frame(priceholtforecast$fitted)
holtforecastTrainpredictions = holtforecastTrain$xhat
head(holtforecastTrainpredictions)
## [1] 32.51193 34.38084 32.82178 31.59478 32.46066 30.74751

Prediction on the Test

priceforecast<-forecast(priceholtforecast,h = 8)
plot(priceforecast,ylim = c(-1000,1000))

Arima Models

model1 = arima(Price,c(0,0,0))
model1
## 
## Call:
## arima(x = Price, order = c(0, 0, 0))
## 
## Coefficients:
##       intercept
##        316.1615
## s.e.     8.8724
## 
## sigma^2 estimated as 57544:  log likelihood = -5043.23,  aic = 10090.47
acf(Price) 

pacf(Price)

plot(Price)

Considering the difference from the graph as d=1 to stationarize

model2 = arima(Price,c(0,1,0))
model2
## 
## Call:
## arima(x = Price, order = c(0, 1, 0))
## 
## 
## sigma^2 estimated as 457.7:  log likelihood = -3271.9,  aic = 6545.8
acf(diff(Price,lag = 1))

pacf(diff(Price,lag = 1))

plot(diff(Price))

plot taking log transform

acf(diff(log10(Price)))

pacf(diff(log10(Price)))

plot(diff(log10(Price)))

Considering the difference from the graph as d=2 to stationarize

model3 = arima(Price,c(0,2,0))
model3
## 
## Call:
## arima(x = Price, order = c(0, 2, 0))
## 
## 
## sigma^2 estimated as 667.2:  log likelihood = -3404.78,  aic = 6811.55
plot(diff(Price,differences = 2))

acf(diff(Price,differences = 2))

pacf(diff(Price,differences = 2))

Observing the acf and pacf

model4 = arima(Price,c(1,1,1))
model4
## 
## Call:
## arima(x = Price, order = c(1, 1, 1))
## 
## Coefficients:
##          ar1     ma1
##       0.1096  0.1729
## s.e.  0.1593  0.1598
## 
## sigma^2 estimated as 423.5:  log likelihood = -3243.58,  aic = 6493.16
Plots of the models
par(mfrow=c(2,2))
plot(model1$residuals,ylim=c(-1000,1000))
plot(model2$residuals,ylim=c(-1000,1000))
plot(model3$residuals,ylim=c(-1000,1000))
plot(model4$residuals,ylim=c(-1000,1000))

Auto ARIMA model

MODEL_ARIMA <- auto.arima(Price, ic='aic')
summary(MODEL_ARIMA)
## Series: Price 
## ARIMA(0,1,1)(0,0,1)[52]                    
## 
## Coefficients:
##          ma1     sma1
##       0.2757  -0.0566
## s.e.  0.0352   0.0367
## 
## sigma^2 estimated as 423.5:  log likelihood=-3242.67
## AIC=6491.35   AICc=6491.38   BIC=6505.13
## 
## Training set error measures:
##                     ME     RMSE      MAE          MPE     MAPE       MASE
## Training set 0.3162176 20.53697 12.46338 -0.009567683 4.453795 0.08373938
##                     ACF1
## Training set 0.004351009

Forecast on the models

pricearimaforecasts1 <- forecast(model1, h=8)
plot(pricearimaforecasts1)

pricearimaforecast3 <- forecast(model3, h=8)
plot(pricearimaforecast3)

pricearimaforecasts_autoArima<- forecast(MODEL_ARIMA,h=8)
plot(pricearimaforecasts_autoArima,flwd = 4)

summary(MODEL_ARIMA)
## Series: Price 
## ARIMA(0,1,1)(0,0,1)[52]                    
## 
## Coefficients:
##          ma1     sma1
##       0.2757  -0.0566
## s.e.  0.0352   0.0367
## 
## sigma^2 estimated as 423.5:  log likelihood=-3242.67
## AIC=6491.35   AICc=6491.38   BIC=6505.13
## 
## Training set error measures:
##                     ME     RMSE      MAE          MPE     MAPE       MASE
## Training set 0.3162176 20.53697 12.46338 -0.009567683 4.453795 0.08373938
##                     ACF1
## Training set 0.004351009