From be5351bc400827e3f567eb45c23f4b5e183815ea Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 13 Apr 2020 19:25:00 -0700 Subject: [PATCH] Updates to R Markdown notebooks (#189) * urca package dependency * Instructions to install fable.prophet * add urca as requirement * add urca to all rmds Co-authored-by: Hong Ooi Former-commit-id: 5ca9eeb7b156b1522b8459f238c1f9f24070436e --- R_utils/cluster.R | 2 +- examples/grocery_sales/R/02_basic_models.Rmd | 1 + examples/grocery_sales/R/02a_reg_models.Rmd | 1 + examples/grocery_sales/R/02b_prophet_models.Rmd | 5 +++++ examples/grocery_sales/R/README.md | 3 ++- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/R_utils/cluster.R b/R_utils/cluster.R index 710b83bd..949101d0 100644 --- a/R_utils/cluster.R +++ b/R_utils/cluster.R @@ -7,7 +7,7 @@ #' @param libs The packages to load on each node, as a character vector. #' @param useXDR For most platforms, this can be left at its default `FALSE` value. #' @return -#' A cluster object. +#' A cluster object. make_cluster <- function(ncores=NULL, libs=character(0), useXDR=FALSE) { if(is.null(ncores)) diff --git a/examples/grocery_sales/R/02_basic_models.Rmd b/examples/grocery_sales/R/02_basic_models.Rmd index 6dda9451..c12fc0e0 100644 --- a/examples/grocery_sales/R/02_basic_models.Rmd +++ b/examples/grocery_sales/R/02_basic_models.Rmd @@ -12,6 +12,7 @@ library(dplyr) library(tsibble) library(feasts) library(fable) +library(urca) ``` We fit some simple models to the orange juice data for illustrative purposes. Here, each model is actually a _group_ of models, one for each combination of store and brand. This is the standard approach taken in statistical forecasting, and is supported out-of-the-box by the tidyverts framework. diff --git a/examples/grocery_sales/R/02a_reg_models.Rmd b/examples/grocery_sales/R/02a_reg_models.Rmd index 581f4e35..a2d790a3 100644 --- a/examples/grocery_sales/R/02a_reg_models.Rmd +++ b/examples/grocery_sales/R/02a_reg_models.Rmd @@ -12,6 +12,7 @@ library(dplyr) library(tsibble) library(feasts) library(fable) +library(urca) ``` This notebook builds on the output from "Basic models" by including regressor variables in the ARIMA model(s). We fit the following model types: diff --git a/examples/grocery_sales/R/02b_prophet_models.Rmd b/examples/grocery_sales/R/02b_prophet_models.Rmd index 0d416e11..13d33f94 100644 --- a/examples/grocery_sales/R/02b_prophet_models.Rmd +++ b/examples/grocery_sales/R/02b_prophet_models.Rmd @@ -12,8 +12,13 @@ library(dplyr) library(tsibble) library(feasts) library(fable) +library(urca) library(prophet) +## NOTE: the following package can be installed from GitHub with +## remotes::install_github("mitchelloharawild/fable.prophet") library(fable.prophet) + +### NOTE: You must run the 02a_reg_models.Rmd notebook before this one ``` This notebook builds a forecasting model using the [Prophet](https://facebook.github.io/prophet/) algorithm. Prophet is a time series model developed by Facebook that is designed to be simple for non-experts to use, yet flexible and powerful. diff --git a/examples/grocery_sales/R/README.md b/examples/grocery_sales/R/README.md index 6e3ca408..f728fa35 100644 --- a/examples/grocery_sales/R/README.md +++ b/examples/grocery_sales/R/README.md @@ -21,6 +21,7 @@ The following packages are needed to run the basic analysis notebooks in this di - fable - feasts - yaml +- urca - here It's likely that you will already have many of these (particularly the [Tidyverse](https://tidyverse.org) packages) installed, if you use R for data science tasks. The main exceptions are the packages in the [Tidyverts](https://tidyverts.org) family, which is a modern framework for time series analysis building on the Tidyverse. @@ -29,7 +30,7 @@ It's likely that you will already have many of these (particularly the [Tidyvers install.packages("tidyverse") # installs all tidyverse packages install.packages("rmarkdown") install.packages("here") -install.packages(c("tsibble", "fable", "feasts")) +install.packages(c("tsibble", "fable", "feasts", "urca")) ``` The following packages are needed to run the Prophet analysis notebook: