# Cleaning the data set by formatting the date
temp_data$dt<-as.Date(temp_data$dt,format="yyyy-mm-dd")
head(temp_data)
## dt LandAverageTemperature LandAverageTemperatureUncertainty
## 1 <NA> 3.034 3.574
## 2 <NA> 3.083 3.702
## 3 <NA> 5.626 3.076
## 4 <NA> 8.490 2.451
## 5 <NA> 11.573 2.072
## 6 <NA> 12.937 1.724
## LandMaxTemperature LandMaxTemperatureUncertainty LandMinTemperature
## 1 NA NA NA
## 2 NA NA NA
## 3 NA NA NA
## 4 NA NA NA
## 5 NA NA NA
## 6 NA NA NA
## LandMinTemperatureUncertainty LandAndOceanAverageTemperature
## 1 NA NA
## 2 NA NA
## 3 NA NA
## 4 NA NA
## 5 NA NA
## 6 NA NA
## LandAndOceanAverageTemperatureUncertainty
## 1 NA
## 2 NA
## 3 NA
## 4 NA
## 5 NA
## 6 NA
tail(temp_data)
## dt LandAverageTemperature LandAverageTemperatureUncertainty
## 3187 <NA> 15.051 0.086
## 3188 <NA> 14.755 0.072
## 3189 <NA> 12.999 0.079
## 3190 <NA> 10.801 0.102
## 3191 <NA> 7.433 0.119
## 3192 <NA> 5.518 0.100
## LandMaxTemperature LandMaxTemperatureUncertainty LandMinTemperature
## 3187 20.904 0.109 9.326
## 3188 20.699 0.110 9.005
## 3189 18.845 0.088 7.199
## 3190 16.450 0.059 5.232
## 3191 12.892 0.093 2.157
## 3192 10.725 0.154 0.287
## LandMinTemperatureUncertainty LandAndOceanAverageTemperature
## 3187 0.225 17.611
## 3188 0.170 17.589
## 3189 0.229 17.049
## 3190 0.115 16.290
## 3191 0.106 15.252
## 3192 0.099 14.774
## LandAndOceanAverageTemperatureUncertainty
## 3187 0.058
## 3188 0.057
## 3189 0.058
## 3190 0.062
## 3191 0.063
## 3192 0.062
# Distribution of Average temperature
options(repr.plot.width=4, repr.plot.height=4)
ggplot(temp_data,aes(x=LandAverageTemperature))+geom_histogram(aes(y=..density..),fill="green")+geom_density(col="red")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 12 rows containing non-finite values (stat_bin).
## Warning: Removed 12 rows containing non-finite values (stat_density).

# Converting data from data frames to time series, in order to continue with time series analysis and forecasting.
options(repr.plot.width=5, repr.plot.height=5)
temp_ts<-ts(temp_data[,2],start=c(1980,1),end=c(2015,12),frequency=12)
autoplot(temp_ts)

ggseasonplot(temp_ts)
## Warning: Removed 3 row(s) containing missing values (geom_path).

# As per the seasonal plot, it is very clear that from January, Avg temperature rises slowly and reaches peak in June, July, after which it falls. This happens every year. By using a seasonal plot, it can help save some space and see the trend clearly at the same time.
# Polar choice to map the seasonal map.
# Plotting the seasonal plot with Polar option.
ggseasonplot(temp_ts,polar=TRUE)

# The above plot tends to have both seasonal and cyclic trends in the Time Series. Ggsubseriesplot is used separately, within the same plot, to plot patterns for each month.
# Naive Forecasting, Lets forecast for next 20 years
temp_fc<-snaive(temp_ts,h=240)
autoplot(temp_fc)

summary(temp_fc)
##
## Forecast method: Seasonal naive method
##
## Model Information:
## Call: snaive(y = temp_ts, h = 240)
##
## Residual sd: 2.263
##
## Error measures:
## ME RMSE MAE MPE MAPE MASE ACF1
## Training set -0.0365 2.260541 1.741005 -6.470187 65.65101 0.9930965 0.332264
##
## Forecasts:
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## Jan 2016 0.865 -2.03199923 3.761999 -3.56557798 5.295578
## Feb 2016 1.045 -1.85199923 3.941999 -3.38557798 5.475578
## Mar 2016 2.289 -0.60799923 5.185999 -2.14157798 6.719578
## Apr 2016 6.379 3.48200077 9.275999 1.94842202 10.809578
## May 2016 9.853 6.95600077 12.749999 5.42242202 14.283578
## Jun 2016 13.744 10.84700077 16.640999 9.31342202 18.174578
## Jul 2016 14.468 11.57100077 17.364999 10.03742202 18.898578
## Aug 2016 14.466 11.56900077 17.362999 10.03542202 18.896578
## Sep 2016 10.497 7.60000077 13.393999 6.06642202 14.927578
## Oct 2016 7.351 4.45400077 10.247999 2.92042202 11.781578
## Nov 2016 5.526 2.62900077 8.422999 1.09542202 9.956578
## Dec 2016 1.873 -1.02399923 4.769999 -2.55757798 6.303578
## Jan 2017 0.865 -3.23197560 4.961976 -5.40078347 7.130783
## Feb 2017 1.045 -3.05197560 5.141976 -5.22078347 7.310783
## Mar 2017 2.289 -1.80797560 6.385976 -3.97678347 8.554783
## Apr 2017 6.379 2.28202440 10.475976 0.11321653 12.644783
## May 2017 9.853 5.75602440 13.949976 3.58721653 16.118783
## Jun 2017 13.744 9.64702440 17.840976 7.47821653 20.009783
## Jul 2017 14.468 10.37102440 18.564976 8.20221653 20.733783
## Aug 2017 14.466 10.36902440 18.562976 8.20021653 20.731783
## Sep 2017 10.497 6.40002440 14.593976 4.23121653 16.762783
## Oct 2017 7.351 3.25402440 11.447976 1.08521653 13.616783
## Nov 2017 5.526 1.42902440 9.622976 -0.73978347 11.791783
## Dec 2017 1.873 -2.22397560 5.969976 -4.39278347 8.138783
## Jan 2018 0.865 -4.15274985 5.882750 -6.80898617 8.538986
## Feb 2018 1.045 -3.97274985 6.062750 -6.62898617 8.718986
## Mar 2018 2.289 -2.72874985 7.306750 -5.38498617 9.962986
## Apr 2018 6.379 1.36125015 11.396750 -1.29498617 14.052986
## May 2018 9.853 4.83525015 14.870750 2.17901383 17.526986
## Jun 2018 13.744 8.72625015 18.761750 6.07001383 21.417986
## Jul 2018 14.468 9.45025015 19.485750 6.79401383 22.141986
## Aug 2018 14.466 9.44825015 19.483750 6.79201383 22.139986
## Sep 2018 10.497 5.47925015 15.514750 2.82301383 18.170986
## Oct 2018 7.351 2.33325015 12.368750 -0.32298617 15.024986
## Nov 2018 5.526 0.50825015 10.543750 -2.14798617 13.199986
## Dec 2018 1.873 -3.14474985 6.890750 -5.80098617 9.546986
## Jan 2019 0.865 -4.92899845 6.658998 -7.99615596 9.726156
## Feb 2019 1.045 -4.74899845 6.838998 -7.81615596 9.906156
## Mar 2019 2.289 -3.50499845 8.082998 -6.57215596 11.150156
## Apr 2019 6.379 0.58500155 12.172998 -2.48215596 15.240156
## May 2019 9.853 4.05900155 15.646998 0.99184404 18.714156
## Jun 2019 13.744 7.95000155 19.537998 4.88284404 22.605156
## Jul 2019 14.468 8.67400155 20.261998 5.60684404 23.329156
## Aug 2019 14.466 8.67200155 20.259998 5.60484404 23.327156
## Sep 2019 10.497 4.70300155 16.290998 1.63584404 19.358156
## Oct 2019 7.351 1.55700155 13.144998 -1.51015596 16.212156
## Nov 2019 5.526 -0.26799845 11.319998 -3.33515596 14.387156
## Dec 2019 1.873 -3.92099845 7.666998 -6.98815596 10.734156
## Jan 2020 0.865 -5.61288720 7.342887 -9.04207354 10.772074
## Feb 2020 1.045 -5.43288720 7.522887 -8.86207354 10.952074
## Mar 2020 2.289 -4.18888720 8.766887 -7.61807354 12.196074
## Apr 2020 6.379 -0.09888720 12.856887 -3.52807354 16.286074
## May 2020 9.853 3.37511280 16.330887 -0.05407354 19.760074
## Jun 2020 13.744 7.26611280 20.221887 3.83692646 23.651074
## Jul 2020 14.468 7.99011280 20.945887 4.56092646 24.375074
## Aug 2020 14.466 7.98811280 20.943887 4.55892646 24.373074
## Sep 2020 10.497 4.01911280 16.974887 0.58992646 20.404074
## Oct 2020 7.351 0.87311280 13.828887 -2.55607354 17.258074
## Nov 2020 5.526 -0.95188720 12.003887 -4.38107354 15.433074
## Dec 2020 1.873 -4.60488720 8.350887 -8.03407354 11.780074
## Jan 2021 0.865 -6.23116989 7.961170 -9.98765532 11.717655
## Feb 2021 1.045 -6.05116989 8.141170 -9.80765532 11.897655
## Mar 2021 2.289 -4.80716989 9.385170 -8.56365532 13.141655
## Apr 2021 6.379 -0.71716989 13.475170 -4.47365532 17.231655
## May 2021 9.853 2.75683011 16.949170 -0.99965532 20.705655
## Jun 2021 13.744 6.64783011 20.840170 2.89134468 24.596655
## Jul 2021 14.468 7.37183011 21.564170 3.61534468 25.320655
## Aug 2021 14.466 7.36983011 21.562170 3.61334468 25.318655
## Sep 2021 10.497 3.40083011 17.593170 -0.35565532 21.349655
## Oct 2021 7.351 0.25483011 14.447170 -3.50165532 18.203655
## Nov 2021 5.526 -1.57016989 12.622170 -5.32665532 16.378655
## Dec 2021 1.873 -5.22316989 8.969170 -8.97965532 12.725655
## Jan 2022 0.865 -6.79973950 8.529740 -10.85720750 12.587208
## Feb 2022 1.045 -6.61973950 8.709740 -10.67720750 12.767208
## Mar 2022 2.289 -5.37573950 9.953740 -9.43320750 14.011208
## Apr 2022 6.379 -1.28573950 14.043740 -5.34320750 18.101208
## May 2022 9.853 2.18826050 17.517740 -1.86920750 21.575208
## Jun 2022 13.744 6.07926050 21.408740 2.02179250 25.466208
## Jul 2022 14.468 6.80326050 22.132740 2.74579250 26.190208
## Aug 2022 14.466 6.80126050 22.130740 2.74379250 26.188208
## Sep 2022 10.497 2.83226050 18.161740 -1.22520750 22.219208
## Oct 2022 7.351 -0.31373950 15.015740 -4.37120750 19.073208
## Nov 2022 5.526 -2.13873950 13.190740 -6.19620750 17.248208
## Dec 2022 1.873 -5.79173950 9.537740 -9.84920750 13.595208
## Jan 2023 0.865 -7.32895119 9.058951 -11.66656694 13.396567
## Feb 2023 1.045 -7.14895119 9.238951 -11.48656694 13.576567
## Mar 2023 2.289 -5.90495119 10.482951 -10.24256694 14.820567
## Apr 2023 6.379 -1.81495119 14.572951 -6.15256694 18.910567
## May 2023 9.853 1.65904881 18.046951 -2.67856694 22.384567
## Jun 2023 13.744 5.55004881 21.937951 1.21243306 26.275567
## Jul 2023 14.468 6.27404881 22.661951 1.93643306 26.999567
## Aug 2023 14.466 6.27204881 22.659951 1.93443306 26.997567
## Sep 2023 10.497 2.30304881 18.690951 -2.03456694 23.028567
## Oct 2023 7.351 -0.84295119 15.544951 -5.18056694 19.882567
## Nov 2023 5.526 -2.66795119 13.719951 -7.00556694 18.057567
## Dec 2023 1.873 -6.32095119 10.066951 -10.65856694 14.404567
## Jan 2024 0.865 -7.82599768 9.555998 -12.42673394 14.156734
## Feb 2024 1.045 -7.64599768 9.735998 -12.24673394 14.336734
## Mar 2024 2.289 -6.40199768 10.979998 -11.00273394 15.580734
## Apr 2024 6.379 -2.31199768 15.069998 -6.91273394 19.670734
## May 2024 9.853 1.16200232 18.543998 -3.43873394 23.144734
## Jun 2024 13.744 5.05300232 22.434998 0.45226606 27.035734
## Jul 2024 14.468 5.77700232 23.158998 1.17626606 27.759734
## Aug 2024 14.466 5.77500232 23.156998 1.17426606 27.757734
## Sep 2024 10.497 1.80600232 19.187998 -2.79473394 23.788734
## Oct 2024 7.351 -1.33999768 16.041998 -5.94073394 20.642734
## Nov 2024 5.526 -3.16499768 14.216998 -7.76573394 18.817734
## Dec 2024 1.873 -6.81799768 10.563998 -11.41873394 15.164734
## Jan 2025 0.865 -8.29611594 10.026116 -13.14571777 14.875718
## Feb 2025 1.045 -8.11611594 10.206116 -12.96571777 15.055718
## Mar 2025 2.289 -6.87211594 11.450116 -11.72171777 16.299718
## Apr 2025 6.379 -2.78211594 15.540116 -7.63171777 20.389718
## May 2025 9.853 0.69188406 19.014116 -4.15771777 23.863718
## Jun 2025 13.744 4.58288406 22.905116 -0.26671777 27.754718
## Jul 2025 14.468 5.30688406 23.629116 0.45728223 28.478718
## Aug 2025 14.466 5.30488406 23.627116 0.45528223 28.476718
## Sep 2025 10.497 1.33588406 19.658116 -3.51371777 24.507718
## Oct 2025 7.351 -1.81011594 16.512116 -6.65971777 21.361718
## Nov 2025 5.526 -3.63511594 14.687116 -8.48471777 19.536718
## Dec 2025 1.873 -7.28811594 11.034116 -12.13771777 15.883718
## Jan 2026 0.865 -8.74325945 10.473259 -13.82956477 15.559565
## Feb 2026 1.045 -8.56325945 10.653259 -13.64956477 15.739565
## Mar 2026 2.289 -7.31925945 11.897259 -12.40556477 16.983565
## Apr 2026 6.379 -3.22925945 15.987259 -8.31556477 21.073565
## May 2026 9.853 0.24474055 19.461259 -4.84156477 24.547565
## Jun 2026 13.744 4.13574055 23.352259 -0.95056477 28.438565
## Jul 2026 14.468 4.85974055 24.076259 -0.22656477 29.162565
## Aug 2026 14.466 4.85774055 24.074259 -0.22856477 29.160565
## Sep 2026 10.497 0.88874055 20.105259 -4.19756477 25.191565
## Oct 2026 7.351 -2.25725945 16.959259 -7.34356477 22.045565
## Nov 2026 5.526 -4.08225945 15.134259 -9.16856477 20.220565
## Dec 2026 1.873 -7.73525945 11.481259 -12.82156477 16.567565
## Jan 2027 0.865 -9.17049970 10.900500 -14.48297234 16.212972
## Feb 2027 1.045 -8.99049970 11.080500 -14.30297234 16.392972
## Mar 2027 2.289 -7.74649970 12.324500 -13.05897234 17.636972
## Apr 2027 6.379 -3.65649970 16.414500 -8.96897234 21.726972
## May 2027 9.853 -0.18249970 19.888500 -5.49497234 25.200972
## Jun 2027 13.744 3.70850030 23.779500 -1.60397234 29.091972
## Jul 2027 14.468 4.43250030 24.503500 -0.87997234 29.815972
## Aug 2027 14.466 4.43050030 24.501500 -0.88197234 29.813972
## Sep 2027 10.497 0.46150030 20.532500 -4.85097234 25.844972
## Oct 2027 7.351 -2.68449970 17.386500 -7.99697234 22.698972
## Nov 2027 5.526 -4.50949970 15.561500 -9.82197234 20.873972
## Dec 2027 1.873 -8.16249970 11.908500 -13.47497234 17.220972
## Jan 2028 0.865 -9.58027926 11.310279 -15.10967609 16.839676
## Feb 2028 1.045 -9.40027926 11.490279 -14.92967609 17.019676
## Mar 2028 2.289 -8.15627926 12.734279 -13.68567609 18.263676
## Apr 2028 6.379 -4.06627926 16.824279 -9.59567609 22.353676
## May 2028 9.853 -0.59227926 20.298279 -6.12167609 25.827676
## Jun 2028 13.744 3.29872074 24.189279 -2.23067609 29.718676
## Jul 2028 14.468 4.02272074 24.913279 -1.50667609 30.442676
## Aug 2028 14.466 4.02072074 24.911279 -1.50867609 30.440676
## Sep 2028 10.497 0.05172074 20.942279 -5.47767609 26.471676
## Oct 2028 7.351 -3.09427926 17.796279 -8.62367609 23.325676
## Nov 2028 5.526 -4.91927926 15.971279 -10.44867609 21.500676
## Dec 2028 1.873 -8.57227926 12.318279 -14.10167609 17.847676
## Jan 2029 0.865 -9.97457856 11.704579 -15.71270483 17.442705
## Feb 2029 1.045 -9.79457856 11.884579 -15.53270483 17.622705
## Mar 2029 2.289 -8.55057856 13.128579 -14.28870483 18.866705
## Apr 2029 6.379 -4.46057856 17.218579 -10.19870483 22.956705
## May 2029 9.853 -0.98657856 20.692579 -6.72470483 26.430705
## Jun 2029 13.744 2.90442144 24.583579 -2.83370483 30.321705
## Jul 2029 14.468 3.62842144 25.307579 -2.10970483 31.045705
## Aug 2029 14.466 3.62642144 25.305579 -2.11170483 31.043705
## Sep 2029 10.497 -0.34257856 21.336579 -6.08070483 27.074705
## Oct 2029 7.351 -3.48857856 18.190579 -9.22670483 23.928705
## Nov 2029 5.526 -5.31357856 16.365579 -11.05170483 22.103705
## Dec 2029 1.873 -8.96657856 12.712579 -14.70470483 18.450705
## Jan 2030 0.865 -10.35502976 12.085030 -16.29455473 18.024555
## Feb 2030 1.045 -10.17502976 12.265030 -16.11455473 18.204555
## Mar 2030 2.289 -8.93102976 13.509030 -14.87055473 19.448555
## Apr 2030 6.379 -4.84102976 17.599030 -10.78055473 23.538555
## May 2030 9.853 -1.36702976 21.073030 -7.30655473 27.012555
## Jun 2030 13.744 2.52397024 24.964030 -3.41555473 30.903555
## Jul 2030 14.468 3.24797024 25.688030 -2.69155473 31.627555
## Aug 2030 14.466 3.24597024 25.686030 -2.69355473 31.625555
## Sep 2030 10.497 -0.72302976 21.717030 -6.66255473 27.656555
## Oct 2030 7.351 -3.86902976 18.571030 -9.80855473 24.510555
## Nov 2030 5.526 -5.69402976 16.746030 -11.63355473 22.685555
## Dec 2030 1.873 -9.34702976 13.093030 -15.28655473 19.032555
## Jan 2031 0.865 -10.72299691 12.452997 -16.85731192 18.587312
## Feb 2031 1.045 -10.54299691 12.632997 -16.67731192 18.767312
## Mar 2031 2.289 -9.29899691 13.876997 -15.43331192 20.011312
## Apr 2031 6.379 -5.20899691 17.966997 -11.34331192 24.101312
## May 2031 9.853 -1.73499691 21.440997 -7.86931192 27.575312
## Jun 2031 13.744 2.15600309 25.331997 -3.97831192 31.466312
## Jul 2031 14.468 2.88000309 26.055997 -3.25431192 32.190312
## Aug 2031 14.466 2.87800309 26.053997 -3.25631192 32.188312
## Sep 2031 10.497 -1.09099691 22.084997 -7.22531192 28.219312
## Oct 2031 7.351 -4.23699691 18.938997 -10.37131192 25.073312
## Nov 2031 5.526 -6.06199691 17.113997 -12.19631192 23.248312
## Dec 2031 1.873 -9.71499691 13.460997 -15.84931192 19.595312
## Jan 2032 0.865 -11.07963381 12.809634 -17.40274100 19.132741
## Feb 2032 1.045 -10.89963381 12.989634 -17.22274100 19.312741
## Mar 2032 2.289 -9.65563381 14.233634 -15.97874100 20.556741
## Apr 2032 6.379 -5.56563381 18.323634 -11.88874100 24.646741
## May 2032 9.853 -2.09163381 21.797634 -8.41474100 28.120741
## Jun 2032 13.744 1.79936619 25.688634 -4.52374100 32.011741
## Jul 2032 14.468 2.52336619 26.412634 -3.79974100 32.735741
## Aug 2032 14.466 2.52136619 26.410634 -3.80174100 32.733741
## Sep 2032 10.497 -1.44763381 22.441634 -7.77074100 28.764741
## Oct 2032 7.351 -4.59363381 19.295634 -10.91674100 25.618741
## Nov 2032 5.526 -6.41863381 17.470634 -12.74174100 23.793741
## Dec 2032 1.873 -10.07163381 13.817634 -16.39474100 20.140741
## Jan 2033 0.865 -11.42592679 13.155927 -17.93235041 19.662350
## Feb 2033 1.045 -11.24592679 13.335927 -17.75235041 19.842350
## Mar 2033 2.289 -10.00192679 14.579927 -16.50835041 21.086350
## Apr 2033 6.379 -5.91192679 18.669927 -12.41835041 25.176350
## May 2033 9.853 -2.43792679 22.143927 -8.94435041 28.650350
## Jun 2033 13.744 1.45307321 26.034927 -5.05335041 32.541350
## Jul 2033 14.468 2.17707321 26.758927 -4.32935041 33.265350
## Aug 2033 14.466 2.17507321 26.756927 -4.33135041 33.263350
## Sep 2033 10.497 -1.79392679 22.787927 -8.30035041 29.294350
## Oct 2033 7.351 -4.93992679 19.641927 -11.44635041 26.148350
## Nov 2033 5.526 -6.76492679 17.816927 -13.27135041 24.323350
## Dec 2033 1.873 -10.41792679 14.163927 -16.92435041 20.670350
## Jan 2034 0.865 -11.76272687 13.492727 -18.44744168 20.177442
## Feb 2034 1.045 -11.58272687 13.672727 -18.26744168 20.357442
## Mar 2034 2.289 -10.33872687 14.916727 -17.02344168 21.601442
## Apr 2034 6.379 -6.24872687 19.006727 -12.93344168 25.691442
## May 2034 9.853 -2.77472687 22.480727 -9.45944168 29.165442
## Jun 2034 13.744 1.11627313 26.371727 -5.56844168 33.056442
## Jul 2034 14.468 1.84027313 27.095727 -4.84444168 33.780442
## Aug 2034 14.466 1.83827313 27.093727 -4.84644168 33.778442
## Sep 2034 10.497 -2.13072687 23.124727 -8.81544168 29.809442
## Oct 2034 7.351 -5.27672687 19.978727 -11.96144168 26.663442
## Nov 2034 5.526 -7.10172687 18.153727 -13.78644168 24.838442
## Dec 2034 1.873 -10.75472687 14.500727 -17.43944168 21.185442
## Jan 2035 0.865 -12.09077440 13.820774 -18.94914709 20.679147
## Feb 2035 1.045 -11.91077440 14.000774 -18.76914709 20.859147
## Mar 2035 2.289 -10.66677440 15.244774 -17.52514709 22.103147
## Apr 2035 6.379 -6.57677440 19.334774 -13.43514709 26.193147
## May 2035 9.853 -3.10277440 22.808774 -9.96114709 29.667147
## Jun 2035 13.744 0.78822560 26.699774 -6.07014709 33.558147
## Jul 2035 14.468 1.51222560 27.423774 -5.34614709 34.282147
## Aug 2035 14.466 1.51022560 27.421774 -5.34814709 34.280147
## Sep 2035 10.497 -2.45877440 23.452774 -9.31714709 30.311147
## Oct 2035 7.351 -5.60477440 20.306774 -12.46314709 27.165147
## Nov 2035 5.526 -7.42977440 18.481774 -14.28814709 25.340147
## Dec 2035 1.873 -11.08277440 14.828774 -17.94114709 21.687147
# In this prediction model, it involves data which is not updated. However, for the past few years, the global temperature has been increasing rapidly. This shows that if we were to be cautious and love our planet, it would have been able to mainstain a constant global temperature.
#Check the residuals of the forecast using check residual function.
checkresiduals(temp_fc)

##
## Ljung-Box test
##
## data: Residuals from Seasonal naive method
## Q* = 224.13, df = 24, p-value < 2.2e-16
##
## Model df: 0. Total lags used: 24
# ARIMA model & Forecasting
fit<-auto.arima(temp_ts,lambda=0)
## Warning in log(x): NaNs produced
## Warning in log(x): NaNs produced
d<-1
D<-1
fit %>%forecast(h=240)%>%autoplot()

checkresiduals(fit)

##
## Ljung-Box test
##
## data: Residuals from ARIMA(3,0,0)(1,1,0)[12] with drift
## Q* = 73.508, df = 19, p-value = 2.379e-08
##
## Model df: 5. Total lags used: 24