library(readxl)
DSRF <- read_excel("D:/DSRF.xlsx")
summary(DSRF)
##      Month                     Comingled Recycling   Cardboard     
##  Min.   :2016-12-01 00:00:00   Min.   : 0.000      Min.   : 0.000  
##  1st Qu.:2017-07-01 00:00:00   1st Qu.: 1.040      1st Qu.: 5.390  
##  Median :2018-02-01 00:00:00   Median : 8.930      Median : 8.250  
##  Mean   :2018-01-30 15:43:26   Mean   : 7.084      Mean   : 6.565  
##  3rd Qu.:2018-09-01 00:00:00   3rd Qu.:10.280      3rd Qu.: 9.000  
##  Max.   :2019-04-01 00:00:00   Max.   :11.520      Max.   :10.750  
##                                                                    
##   Organics In    Organics Out (Dehydrator)  Orca (trial)     Polystyrene    
##  Min.   : 0.00   Min.   :0.000             Min.   : 0.000   Min.   :0.0000  
##  1st Qu.: 9.89   1st Qu.:1.180             1st Qu.: 0.000   1st Qu.:0.1125  
##  Median :11.30   Median :5.390             Median : 4.580   Median :0.1450  
##  Mean   :11.64   Mean   :4.716             Mean   : 5.174   Mean   :0.1269  
##  3rd Qu.:17.29   3rd Qu.:7.790             3rd Qu.: 9.280   3rd Qu.:0.1700  
##  Max.   :25.80   Max.   :9.560             Max.   :16.240   Max.   :0.2300  
##                                                             NA's   :3       
##  Cardboard Waxed  Soft Plastics    
##  Min.   :0.0000   Min.   :0.00000  
##  1st Qu.:0.3100   1st Qu.:0.00000  
##  Median :0.3950   Median :0.00000  
##  Mean   :0.3428   Mean   :0.01444  
##  3rd Qu.:0.4250   3rd Qu.:0.01500  
##  Max.   :0.5000   Max.   :0.10000  
##  NA's   :11       NA's   :11
CR <- DSRF$`Comingled Recycling`
CR[CR == 0] <- mean(CR)
CardBoard <- DSRF$Cardboard
CardBoard[CardBoard == 0] <- mean(CardBoard)
OrganicIN <- DSRF$`Organics In`
OrganicIN[OrganicIN == 0] <- mean(OrganicIN)
OrganicOUT <- DSRF$`Organics Out (Dehydrator)`
OrganicOUT[OrganicOUT == 0] <- mean(OrganicOUT)
Orca <- DSRF$`Orca (trial)`
Orca[Orca == 0] <- mean(Orca)
Polyst <- DSRF$Polystyrene
Poly <- na.omit(Polyst)
Poly[Poly == 0] <- mean(Poly)
CradWaxed <- DSRF$`Cardboard Waxed`
CardWax <- na.omit(CradWaxed)
CardWax[CardWax == 0] <- mean(CardWax)
SoftPlastics <- DSRF$`Soft Plastics`
Softplastics <- na.omit(SoftPlastics)
Softplastics[Softplastics == 0] <- mean(Softplastics)

Convert to Time Series

CR_ts=ts(CR,start=c(2016,12), frequency=12)
CardBoard_ts = ts(CardBoard,start=c(2016,12), frequency=12)
OrganicIN_ts = ts(OrganicIN,start=c(2016,12), frequency=12)
OrganicOUT_ts = ts(OrganicOUT,start=c(2016,12), frequency=12)
Orca_ts = ts(Orca,start=c(2016,12), frequency=12)
Poly_ts = ts(Poly,start=c(2017,2), frequency=12)
CardWax_ts = ts(CardWax,start=c(2017,10), frequency=12)
Softplastics_ts = ts(Softplastics,start=c(2017,10), frequency=12)

#Plotting Time Sries

library(TSstudio)

CR_PLOT <- ts_plot(CR_ts,
        title = "Commingled Recycling",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

CardBoard_PLOT <- ts_plot(CardBoard_ts,
        title = "CardBoard",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

OrganicIN_PLOT <- ts_plot(OrganicIN_ts,
        title = "Organics IN",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

OrganicOUT_PLOT <- ts_plot(OrganicOUT_ts,
        title = "Organics Out (Dehydrator)",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

Orca_PLOT <- ts_plot(Orca_ts,
        title = "Orca (Trial)",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

Poly_PLOT <- ts_plot(Poly_ts,
        title = "Polystyrene",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

CardWax_PLOT <- ts_plot(CardWax_ts,
        title = "Cardboard Waxed",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)

Softplastics_PLOT <- ts_plot(Softplastics_ts,
        title = "Soft Plastics",
        Xtitle = "Time",
        Ytitle = "Tonnage",
        slider = TRUE)
CR_PLOT 
CardBoard_PLOT 
OrganicIN_PLOT 
OrganicOUT_PLOT
Orca_PLOT
Poly_PLOT
CardWax_PLOT 
Softplastics_PLOT 

Comingled Recycling

#Scatter Plot and correlation
plot(y=CR_ts, x=zlag(CR_ts), xlab='Previous Year',ylab='Comingled Recycling', main="Scatter Plot of Comingled Recycling")

y=CR_ts 
x=zlag(CR_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.03066704

There is no Correlation observed among the succeeding points. the correlaton of 0.03 confirms the same. There is no Seasonality or Trend.

Simple Exponential Smoothing

ses.CR <- ses(CR_ts, alpha = .2, h = 12)
autoplot(ses.CR, main = 'Forecast from Simple Exponential Smoothing of Commingled Recycling')

ses.CR
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## May 2019       9.535012 6.727129 12.34290 5.240725 13.82930
## Jun 2019       9.535012 6.671521 12.39850 5.155681 13.91434
## Jul 2019       9.535012 6.616974 12.45305 5.072258 13.99777
## Aug 2019       9.535012 6.563427 12.50660 4.990366 14.07966
## Sep 2019       9.535012 6.510829 12.55919 4.909923 14.16010
## Oct 2019       9.535012 6.459130 12.61089 4.830856 14.23917
## Nov 2019       9.535012 6.408285 12.66174 4.753096 14.31693
## Dec 2019       9.535012 6.358254 12.71177 4.676581 14.39344
## Jan 2020       9.535012 6.308999 12.76102 4.601252 14.46877
## Feb 2020       9.535012 6.260485 12.80954 4.527056 14.54297
## Mar 2020       9.535012 6.212679 12.85734 4.453943 14.61608
## Apr 2020       9.535012 6.165552 12.90447 4.381867 14.68816

Cardboard

#Scatter Plot and correlation
plot(y=CardBoard_ts, x=zlag(CardBoard_ts), xlab='Previous Year',ylab='Cardboard', main="Scatter Plot of Cardboard")

y=CardBoard_ts 
x=zlag(CardBoard_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] -0.1817916

There is no Correlation observed among the succeeding points. the correlaton of-0.018 confirms the same. There is no Seasonality or Trend.

Simple Exponential Smoothing

ses.CB <- ses(CardBoard_ts, alpha = .2, h = 12)
autoplot(ses.CB, main = 'Forecast from Simple Exponential Smoothing of Cardboard')

ses.CB
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## May 2019       7.695792 5.271387 10.12020 3.987985 11.40360
## Jun 2019       7.695792 5.223375 10.16821 3.914556 11.47703
## Jul 2019       7.695792 5.176277 10.21531 3.842526 11.54906
## Aug 2019       7.695792 5.130043 10.26154 3.771818 11.61977
## Sep 2019       7.695792 5.084628 10.30696 3.702362 11.68922
## Oct 2019       7.695792 5.039990 10.35159 3.634093 11.75749
## Nov 2019       7.695792 4.996089 10.39550 3.566953 11.82463
## Dec 2019       7.695792 4.952891 10.43869 3.500887 11.89070
## Jan 2020       7.695792 4.910363 10.48122 3.435846 11.95574
## Feb 2020       7.695792 4.868475 10.52311 3.371783 12.01980
## Mar 2020       7.695792 4.827198 10.56439 3.308656 12.08293
## Apr 2020       7.695792 4.786506 10.60508 3.246424 12.14516

Organics In

#Scatter Plot and correlation
plot(y=OrganicIN_ts, x=zlag(OrganicIN_ts), xlab='Previous Year',ylab='Organic IN', main="Scatter Plot of Organic In")

y=OrganicIN_ts 
x=zlag(OrganicIN_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.5576596

There is Correlation observed among the succeeding points. the correlaton of 0.55 confirms a moderate posiitve relationship. There is no Seasonality BUT A Trend. Therefore we will use Holt’s Trend model

DIFFERENT TREND MODEL TO IMPLEMENT

holt.OrganicIN <- holt(OrganicIN_ts,
                  h = 12)
autoplot(holt.OrganicIN, main = 'Forecast from Holts Method of Organics IN')

holt.OrganicIN
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## May 2019       18.15189 13.68956 22.61422 11.32735 24.97644
## Jun 2019       18.40494 13.76140 23.04848 11.30326 25.50662
## Jul 2019       18.65799 13.83994 23.47605 11.28942 26.02657
## Aug 2019       18.91104 13.92446 23.89763 11.28473 26.53736
## Sep 2019       19.16409 14.01439 24.31380 11.28830 27.03989
## Oct 2019       19.41715 14.10921 24.72508 11.29937 27.53493
## Nov 2019       19.67020 14.20852 25.13187 11.31728 28.02311
## Dec 2019       19.92325 14.31193 25.53456 11.34148 28.50502
## Jan 2020       20.17630 14.41913 25.93346 11.37147 28.98112
## Feb 2020       20.42935 14.52984 26.32886 11.40683 29.45187
## Mar 2020       20.68240 14.64381 26.72099 11.44717 29.91763
## Apr 2020       20.93545 14.76082 27.11009 11.49216 30.37874

Organics Out (Dehydrator)

#Scatter Plot and correlation
plot(y=OrganicOUT_ts, x=zlag(OrganicOUT_ts), xlab='Previous Year',ylab='Organic Out', main="Scatter Plot of Organic Out")

y=OrganicOUT_ts 
x=zlag(OrganicOUT_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.6485924

There is Correlation observed among the succeeding point BUT there is a Trend. The correlaton of 0.64 confirms a moderate posiitve relationship. There is no Seasonality BUT A Trend.

Different Model to implement

holt.OrganicOUT <- holt(OrganicOUT_ts,
                  h = 12)
autoplot(holt.OrganicOUT, main = 'Forecast from Holts Method of Organics OUT')

holt.OrganicOUT
##          Point Forecast     Lo 80    Hi 80       Lo 95    Hi 95
## May 2019      6.5847888  4.736243 8.433334  3.75768257 9.411895
## Jun 2019      6.0670240  4.176842 7.957206  3.17623971 8.957808
## Jul 2019      5.5492593  3.568592 7.529927  2.52008957 8.578429
## Aug 2019      5.0314946  2.899425 7.163564  1.77077571 8.292213
## Sep 2019      4.5137298  2.164549 6.862911  0.92096754 8.106492
## Oct 2019      3.9959651  1.365438 6.626492 -0.02707876 8.019009
## Nov 2019      3.4782004  0.507238 6.449163 -1.06549446 8.021895
## Dec 2019      2.9604356 -0.403687 6.324558 -2.18454595 8.105417
## Jan 2020      2.4426709 -1.361224 6.246566 -3.37488465 8.260226
## Feb 2020      1.9249062 -2.360108 6.209920 -4.62845682 8.478269
## Mar 2020      1.4071415 -3.396017 6.210300 -5.93865526 8.752938
## Apr 2020      0.8893767 -4.465473 6.244226 -7.30015887 9.078912

Orca (Trial)

#Scatter Plot and correlation
plot(y=Orca_ts, x=zlag(Orca_ts), xlab='Previous Year',ylab='Orca', main="Scatter Plot of Orca")

y=Orca_ts 
x=zlag(Orca_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.5400223

There is Correlation observed among the succeeding points. the correlaton of 0.54 confirms a moderate posiitve relationship . There is no Seasonality but there is a Trend.

Different Model to Implement

holt.orca <- holt(Orca_ts,
                  h = 12)
autoplot(holt.orca, main = 'Forecast from Holts Method of Orca')

holt.orca
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## May 2019       9.893987 6.126386 13.66159 4.131938 15.65604
## Jun 2019      10.021597 6.040520 14.00267 3.933065 16.11013
## Jul 2019      10.149207 5.965417 14.33300 3.750652 16.54776
## Aug 2019      10.276817 5.899581 14.65405 3.582412 16.97122
## Sep 2019      10.404427 5.841833 14.96702 3.426541 17.38231
## Oct 2019      10.532037 5.791225 15.27285 3.281590 17.78248
## Nov 2019      10.659648 5.746979 15.57232 3.146370 18.17293
## Dec 2019      10.787258 5.708450 15.86607 3.019891 18.55462
## Jan 2020      10.914868 5.675093 16.15464 2.901324 18.92841
## Feb 2020      11.042478 5.646446 16.43851 2.789959 19.29500
## Mar 2020      11.170088 5.622111 16.71807 2.685189 19.65499
## Apr 2020      11.297698 5.601742 16.99365 2.586485 20.00891

Polystyrene

#Scatter Plot and correlation
plot(y=Poly_ts, x=zlag(Poly_ts), xlab='Previous Year',ylab='Polystyrene', main="Scatter Plot of Polystyrene")

y=Poly_ts 
x=zlag(Poly_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.11161

There is no Correlation observed among the succeeding points. the correlaton of 0.1 confirms the same. There is no Seasonality or Trend.

Simple Exponential Smoothing

ses.poly <- ses(Poly_ts, alpha = .2, h = 12)
autoplot(ses.poly, main = 'Forecasts Simple Exponential Smoothing of Polystyrene')

ses.poly
##          Point Forecast      Lo 80     Hi 80      Lo 95     Hi 95
## Apr 2019      0.1443205 0.10519008 0.1834509 0.08447569 0.2041653
## May 2019      0.1443205 0.10441515 0.1842258 0.08329053 0.2053504
## Jun 2019      0.1443205 0.10365498 0.1849860 0.08212795 0.2065130
## Jul 2019      0.1443205 0.10290876 0.1857322 0.08098671 0.2076543
## Aug 2019      0.1443205 0.10217575 0.1864652 0.07986567 0.2087753
## Sep 2019      0.1443205 0.10145527 0.1871857 0.07876380 0.2098772
## Oct 2019      0.1443205 0.10074671 0.1878943 0.07768015 0.2109608
## Nov 2019      0.1443205 0.10004949 0.1885915 0.07661383 0.2120271
## Dec 2019      0.1443205 0.09936307 0.1892779 0.07556405 0.2130769
## Jan 2020      0.1443205 0.09868698 0.1899540 0.07453007 0.2141109
## Feb 2020      0.1443205 0.09802077 0.1906202 0.07351117 0.2151298
## Mar 2020      0.1443205 0.09736400 0.1912770 0.07250674 0.2161342

Cardboard Waxed

#Scatter Plot and correlation
plot(y=CardWax_ts, x=zlag(CardWax_ts), xlab='Previous Year',ylab='Cardard Waxed', main="Scatter Plot of Cardard Waxed")

y=CardWax_ts 
x=zlag(CardWax_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.1144103

There is no Correlation observed among the succeeding points. the correlaton of0.1 confirms the same. There is no Seasonality or Trend.

Simple Exponential Smoothing

ses.CW <- ses(CardWax_ts, alpha = .2, h = 12)
autoplot(ses.CW, main = 'Forecasts Simple Exponential Smoothing of Cardboard Waxed')

ses.CW
##          Point Forecast     Lo 80     Hi 80     Lo 95     Hi 95
## Apr 2019      0.3887413 0.3012432 0.4762394 0.2549245 0.5225581
## May 2019      0.3887413 0.2995104 0.4779722 0.2522744 0.5252082
## Jun 2019      0.3887413 0.2978106 0.4796720 0.2496748 0.5278078
## Jul 2019      0.3887413 0.2961420 0.4813406 0.2471229 0.5303597
## Aug 2019      0.3887413 0.2945030 0.4829797 0.2446162 0.5328664
## Sep 2019      0.3887413 0.2928919 0.4845907 0.2421523 0.5353303
## Oct 2019      0.3887413 0.2913075 0.4861751 0.2397292 0.5377534
## Nov 2019      0.3887413 0.2897485 0.4877341 0.2373449 0.5401378
## Dec 2019      0.3887413 0.2882136 0.4892690 0.2349975 0.5424851
## Jan 2020      0.3887413 0.2867019 0.4907808 0.2326854 0.5447972
## Feb 2020      0.3887413 0.2852122 0.4922705 0.2304071 0.5470755
## Mar 2020      0.3887413 0.2837436 0.4937391 0.2281611 0.5493215

Soft Plastics

#Scatter Plot and correlation
plot(y=Softplastics_ts, x=zlag(Softplastics_ts), xlab='Previous Year',ylab='Soft Plastics', main="Scatter Plot of Soft Plastics")

y=Softplastics_ts 
x=zlag(Softplastics_ts) 
index= 2:length(x) 
cor(y[index], x[index])
## [1] 0.3259405

There is no Correlation observed among the succeeding points. the correlaton of 0.3 confirms the same. There is no Seasonality or Trend.

Simple Exponential Smoothing

ses.SP <- ses(Softplastics_ts, alpha = .2, h = 12)
autoplot(ses.SP, main = 'Forecast from Simple Exponential of Smoothing Soft Plastics')

ses.SP
##          Point Forecast       Lo 80      Hi 80       Lo 95      Hi 95
## Apr 2019     0.01638936 -0.01312314 0.04590187 -0.02874612 0.06152485
## May 2019     0.01638936 -0.01370761 0.04648633 -0.02963998 0.06241871
## Jun 2019     0.01638936 -0.01428093 0.04705966 -0.03051681 0.06329554
## Jul 2019     0.01638936 -0.01484374 0.04762247 -0.03137754 0.06415627
## Aug 2019     0.01638936 -0.01539658 0.04817531 -0.03222304 0.06500177
## Sep 2019     0.01638936 -0.01593997 0.04871870 -0.03305408 0.06583281
## Oct 2019     0.01638936 -0.01647437 0.04925310 -0.03387138 0.06665011
## Nov 2019     0.01638936 -0.01700023 0.04977896 -0.03467561 0.06745434
## Dec 2019     0.01638936 -0.01751792 0.05029665 -0.03546736 0.06824609
## Jan 2020     0.01638936 -0.01802784 0.05080657 -0.03624720 0.06902593
## Feb 2020     0.01638936 -0.01853030 0.05130903 -0.03701566 0.06979439
## Mar 2020     0.01638936 -0.01902564 0.05180437 -0.03777322 0.07055195