1. 시계열 데이터 만들기
ts()
2. 시계열 데이터(Training data)를 가지고 Forecating하기
y = data, h=예측횟수
meanf(y, h)
예시:
b <- meanf(a10, h=10, level=95)
autoplot(b)
rwf(y, h)
예시:
d <- rwf(a10, h=10, level=95)
autoplot(d)
rwf(y, h, drift=TRUE)
예시:
e <- rwf(a10, h=10, level=95, drift =TRUE)
autoplot(e)
naive(y, h)
예시:
a <- naive(a10, h=10, level=95)
autoplot(a)
snaive(y, h)
예시:
c <- snaive(a10, h=10, level=95)
autoplot(c)
rwf() returns forecasts and prediction intervals for a random walk with drift model applied to y. This is equivalent to an ARIMA(0,1,0) model with an optional drift coefficient. naive() is simply a wrapper to rwf() for simplicity. snaive() returns forecasts and prediction intervals from an ARIMA(0,0,0)(0,1,0)m model where m is the seasonal period.
3. 더 적합한 Forecasting 모델 찾기(Forecasted data와 Test data 비교)
accuracy(forecasted data, test data)
Forecast 모델의 정확도를 판단할 때, RMSE를 많이 사용하는데, RMSE값이 적은 모델이 더 좋은 모델이다.
Time Series Cross Validation
tsCV(y, forecast method, h)
Trainig data와 Forecasted data와의 차이를 구한다.
e <- tsCV(dj, rwf, drift=TRUE, h=1)
sqrt(mean(e^2, na.rm=TRUE))
이 계산을 수행하고 나온 숫자가 적은 모델일 수록 좋은 모델이다.
R의 첫걸음_엑셀 데이터 읽어오기. (0) | 2022.11.22 |
---|---|
Global supply chain rank (0) | 2022.11.14 |
R을 왜 배워야할까?? (1) | 2022.10.10 |
물류용어_및_영어번역 20220713 (0) | 2022.07.13 |
물류용어_및_영어번역_20220712 (0) | 2022.07.12 |
댓글 영역