预测和分解时间序列数据(小时)Forecast and STL hourly time series data

d0 <- as.POSIXct(
  "2014-01-01 00:00:00",
  format="%Y-%m-%d %H:%M:%S",
  tz="America/New_York")
##
dWeek <- d0 + seq(
  from=0,
  to=(3600*167),
  by=3600
)
##
set.seed(1234)
x <- rnorm(168,50,5)
tsData <- data.frame(
  Time = dWeek,
  Value=x,
  stringsAsFactors=FALSE)
x.ts <- ts(
  tsData$Value,
  frequency=24,
  start=1)
##
fit <- stl(x.ts,s.window="periodic")
plot(fit)

你可能感兴趣的:(时间序列,R)