시즌 별 판매량을 예측하고 싶습니다. Quick-R에서 일부 웹 페이지를 읽은 후 일부 명사 (예 : 지연)를 이해할 수는 없지만 판매량 데이터를 예측하려고했습니다. 예측 된 판매 금액이 계절이 아니기 때문에계절 매출액 예측 방법 R
# load library
library(dplyr)
library(lubridate)
library(forecast)
# fake data
set.seed(4)
amount_2014 <- c(sample(3000:3500, 6), sample(4000:5000, 6))
set.seed(5)
amount_2015 <- c(sample(3000:3500, 6), sample(4000:5000, 6))
set.seed(6)
amount_2016 <- c(sample(3000:3500, 6), sample(4000:5000, 4))
sales <- data.frame(year = c(rep(2014, 12), rep(2014, 12), rep(2016, 10)),
month = c(1:12, 1:12, 1:10),
amount = c(amount_2014, amount_2015, amount_2016))
sales <- sales %>% mutate(Month = ymd(paste(year, month), truncated =2)) %>%
arrange(Month)
sales_ts <- ts(sales$amount, start = c(sales$year[1], sales$month[1]),
frequency = 12)
# first try
sales_ts_fc_1 <- forecast(sales_ts, h = 13)
sales_ts_fc_1 # the forecast for every month is same
# then try
auto.arima(sales_ts)
sales_ts_arima <- arima(sales_ts, order = c(0, 1, 0))
sales_ts_fc_2 <- forecast.Arima(sales_ts_arima, h = 13)
sales_ts_fc_2 # the forecst for evey month is very close
두 시도가 실패
는 여기에 몇 가지 코드입니다.
계절 데이터를 어떻게 예측하나요?
감사합니다.
this을 읽을 모델 계절 홀트 윈터스를 사용하려고 [SO]는 Q & 자체 포함, 콘크리트 * * 코딩 질문에 대한 사이트입니다. 필요한 것은 시계열 분석 및 예측을 배우는 것입니다. 그것은 실제로 SO가 무엇을위한 것이지 &이 프레임 워크 내에서하기에는 너무 크다. – gung