1 Create time series
2 Seasonal decomposition
3 exponential model
4 ARIMA Model
5 Automatic prediction
The first step : Create time series
use ts() Function converts a number vector into a time series , In the form of
ts(vector,start=,end=,frequency=),frequency=(1=annual,4=quartly,12=monthly,etc)
Part two : Seasonal decomposition
If the time series tends to increase , Seasonality , And irregular components , You can use the stl() function , If the multiple effects of time series can be used log(ts)
# Seasonal decomposition fit=stl(ts,s.window="period") plot(fit) # Add diagram monthplot(ts)
library(forest) seasonplt(ts)
Step three : exponential model
# Simple exponential smoothing model fit=HoltWinters(ts,beta=F,gamma=F) # have models level and trend
fit=HoltWinters(ts,beta=F)# have models levels,trend and seasonal compontents
fit=HoltWinters(ts)#predict accuracy library(forecast) accuracy(fit) #predict
next three future values library(forecast) forecast(fit,3) plot(forecast(fit,3))

Technology
©2019-2020 Toolsou All rights reserved,
Final review of database : Summary of comprehensive application questions Laplance operator ( Second derivative ) Simple learning of computer composition principle pyqt Button call python program _PyQt: Link button to function in program How much can you go up once you change jobs ? Today, I saw the ceiling of job hopping python in str Function usage _python in str Usage Summary of built-in functions MySQL trigger web The server nginx---linux Installation and deployment C++ Chapter V polymorphism exercises :( It's coming to an end )python Check built-in functions , How to check python Built in function