knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width=8 )
library(forecastLM)
library(TSstudio) data(USgas) ts_info(USgas) ts_plot(USgas, title = "US Monthly Natural Gas Consumption", Xtitle = "U.S. Bureau of Transportation Statistics, Natural Gas Consumption [NATURALGAS]", Ytitle = "Billion Cubic Feet" )
ts_decompose(USgas)
md1 <- trainLM(input = USgas, trend = list(linear = TRUE)) plot_fit(md1)
md2 <- trainLM(input = USgas, trend = list(linear = FALSE, log = TRUE)) plot_fit(md2)
md3 <- trainLM(input = USgas, trend = list(linear = TRUE, log = TRUE)) plot_fit(md3)
md4 <- trainLM(input = USgas, trend = list(linear = FALSE, log = FALSE, power = 1:3)) plot_fit(md4)
md5 <- trainLM(input = USgas, trend = list(linear = FALSE, log = FALSE, power = NULL), splines = list(break1 = list(type = "linear", knots = as.Date("2010-01-01")))) plot_fit(md5) head(md5$series) tail(md5$series)
md6 <- trainLM(input = USgas, seasonal = "month", trend = list(linear = TRUE, log = FALSE, power = NULL), splines = list(break1 = list(type = "linear", knots = as.Date("2010-01-01")))) plot_fit(md6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.