knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width=8
)
library(forecastLM)
data("ny_elec")

head(ny_elec)

class(ny_elec)
library(TSstudio)

ts_plot(ny_elec,
        title = "Net Generation of Electricity for the New York Region",
        Ytitle = "Megawatthours",
        Xtitle = "Source: US Energy Information Administration (Jan 2020)",
        slider = TRUE)
md1 <- trainLM(input = ny_elec,
               y = "y",
               seasonal = c("month"),
               trend = list(linear = TRUE))


plot_res(md1)
md2 <- trainLM(input = ny_elec,
               y = "y",
               seasonal = c("month", "wday"),
               trend = list(linear = TRUE))


plot_res(md2)
md3 <- trainLM(input = ny_elec,
               y = "y",
               seasonal = c("month", "wday", "hour"),
               trend = list(linear = TRUE))


plot_res(md3)
md4 <- trainLM(input = ny_elec,
               y = "y",
               seasonal = c("month", "wday", "hour"),
               trend = list(linear = TRUE),
               lags = c(1:24))


plot_res(md4)
md5 <- trainLM(input = ny_elec,
               y = "y",
               seasonal = c("month", "wday", "hour"),
               trend = list(linear = TRUE),
               lags = c(1:24, 48, 72))


plot_res(md5)
summary(md5)


RamiKrispin/forecastLM documentation built on April 4, 2020, 1:48 a.m.