เตรียมข้อมูล
library(timeDate)
library(timeSeries)
sales <- c(28, 22, 22, 26, 18, 35, 30, 38, 45, 30, 40, 45)
advertising <- c(1, 1.6, 1.8, 2, 2.6, 2, 3, 3, 4.5, 4, 4, 4)
comsale <- cbind(sales, advertising)
comsale <- data.frame(comsale)
comsale.ts <- ts(data = comsale, start = c(2020), freq = 12)
comsale.ts <- data.frame(comsale.ts)
attach(comsale.ts)