Time Series Dataset : Beijing Air Quality

Forecating Air Quality with Profet

changping<-read.csv("C:/Users/Hetal Sawant/Desktop/Spring sem/Forecasting/HW/PRSA_Data_Changping_20130301-20170228.csv")
attach(changping)
#str(changping)
head(changping)
##   No year month day hour PM2.5 PM10 SO2 NO2  CO O3 TEMP   PRES  DEWP RAIN  wd
## 1  1 2013     3   1    0     3    6  13   7 300 85 -2.3 1020.8 -19.7    0   E
## 2  2 2013     3   1    1     3    3   6   6 300 85 -2.5 1021.3 -19.0    0 ENE
## 3  3 2013     3   1    2     3    3  22  13 400 74 -3.0 1021.3 -19.9    0 ENE
## 4  4 2013     3   1    3     3    6  12   8 300 81 -3.6 1021.8 -19.1    0 NNE
## 5  5 2013     3   1    4     3    3  14   8 300 81 -3.5 1022.3 -19.4    0   N
## 6  6 2013     3   1    5     3    3  10  17 400 71 -4.5 1022.6 -19.5    0 NNW
##   WSPM   station
## 1  0.5 Changping
## 2  0.7 Changping
## 3  0.2 Changping
## 4  1.0 Changping
## 5  2.1 Changping
## 6  1.7 Changping
##   No year month day hour PM2.5 PM10 SO2 NO2  CO O3 TEMP   PRES  DEWP RAIN  wd
## 1  1 2013     3   1    0     3    6  13   7 300 85 -2.3 1020.8 -19.7    0   E
## 2  2 2013     3   1    1     3    3   6   6 300 85 -2.5 1021.3 -19.0    0 ENE
## 3  3 2013     3   1    2     3    3  22  13 400 74 -3.0 1021.3 -19.9    0 ENE
## 4  4 2013     3   1    3     3    6  12   8 300 81 -3.6 1021.8 -19.1    0 NNE
## 5  5 2013     3   1    4     3    3  14   8 300 81 -3.5 1022.3 -19.4    0   N
## 6  6 2013     3   1    5     3    3  10  17 400 71 -4.5 1022.6 -19.5    0 NNW
##   WSPM   station         y1
## 1  0.5 Changping 2013-03-01
## 2  0.7 Changping 2013-03-01
## 3  0.2 Changping 2013-03-01
## 4  1.0 Changping 2013-03-01
## 5  2.1 Changping 2013-03-01
## 6  1.7 Changping 2013-03-01

Assesing the Changping SO2 levels over the 5 years of period using Facebook Prophet model:

Estimating Changepoints

We can observe the change-points at the beginning (Jan- Feb) and end (Nov - Dec) of each year.

Assesing saturation points:

It is expected to have positive values for SO2 levels. Maximum SO2 levels observed are 340 and minimum is 10. We can see the same reflecting in below graphs. We also observed predicted values slightly towards negative number.

##Seasonality : With Additive and Multiplicative

Cross-validation to assess performance of the model

##    y         ds     yhat yhat_lower yhat_upper     cutoff
## 1 27 2015-03-25 4.291868  -20.30234   30.58157 2015-03-24
## 2 27 2015-03-25 4.291868  -22.46475   29.84741 2015-03-24
## 3 27 2015-03-25 4.291868  -21.35638   30.16130 2015-03-24
## 4 27 2015-03-25 4.291868  -20.81661   30.32415 2015-03-24
## 5 27 2015-03-25 4.291868  -20.82622   29.80059 2015-03-24
## 6 27 2015-03-25 4.291868  -22.92249   27.22851 2015-03-24
## [1] "2015-03-24 GMT" "2015-04-23 GMT" "2015-05-23 GMT" "2015-06-22 GMT"
## [5] "2015-07-22 GMT" "2015-08-21 GMT" "2015-09-20 GMT" "2015-10-20 GMT"

## <ggproto object: Class ScaleDiscrete, Scale, gg>
##     aesthetics: colour
##     axis_order: function
##     break_info: function
##     break_positions: function
##     breaks: waiver
##     call: call
##     clone: function
##     dimension: function
##     drop: TRUE
##     expand: waiver
##     get_breaks: function
##     get_breaks_minor: function
##     get_labels: function
##     get_limits: function
##     guide: legend
##     is_discrete: function
##     is_empty: function
##     labels: waiver
##     limits: NULL
##     make_sec_title: function
##     make_title: function
##     map: function
##     map_df: function
##     n.breaks.cache: NULL
##     na.translate: TRUE
##     na.value: grey50
##     name: Cutoff
##     palette: function
##     palette.cache: NULL
##     position: left
##     range: <ggproto object: Class RangeDiscrete, Range, gg>
##         range: NULL
##         reset: function
##         train: function
##         super:  <ggproto object: Class RangeDiscrete, Range, gg>
##     rescale: function
##     reset: function
##     scale_name: hue
##     train: function
##     train_df: function
##     transform: function
##     transform_df: function
##     super:  <ggproto object: Class ScaleDiscrete, Scale, gg>