Tag: time series
I recently came across Datawrapper while checking out New York City’s COVID-19 Vaccines page and - going on appearance alone - the charts, tables, and maps (hosted & served by Datawrapper) appear attractive, responsive, and have a cohesive look.
As I am always interested in checking out new visualization tools, I took the Datawrapper API (and GUI) for a spin and created the below example as a proof of concept - you can hover-and-click on the map points to read additional information:
Following full vaccination, folks have begun venturing outdoors for the first time in long while - myself included! In support of outdoor-activity planning, today’s post is going to cover forecasting national park visits for each month of 2021.
Since there are 63 National Parks in the US across 30 states and two territories, I will employ the sweep package to address the scale of forecasts to be made/reviewed all while keeping the data in a tidy format.
In this post I will be creating a call-volume forecast with my NYC EMS data using python’s tensorflow_probability library. In particular, I’ll employ that library’s sts method that provides the ability to create Bayesian structural time series (BSTS) forecasts.
Structural Time Series Forecasting
Unlike traditional time-series model forecasting, BSTS models can be used for prediction for multiple correlated time series while handling large variations in the short term. The Bayesian part, with respect to multivariate variables, assists the model to avoid over-fitting and identify correlations among the variables.
Multivariate time-series forecasting is a non-trivial task when it comes to complex seasonality. Forecasting: Principles and Practice by R.J. Hyndman and G. Athanasopoulo, gives several powerful examples if you’re using R and dealing with seasonality using Fourier terms for each seasonal period (kinda like I did in this post).
In this post I’ll be using’s Keras RNN’s module for LSTM in python and forecasting the next 24 hours of call volume, per hour, into the future using the past 24 hours of my EMS data along with hourly weather data from Central Park via the NOAA.
Traditional forecasting methods require stationary data to make a valid forecast. In this post I’ll run through a relatively simple time-series forecast that employs forcast package’s auto.arima function and regression tress to via the rpart library.
library(RCurl)
library(forecast)
library(lubridate)
library(tidyverse)
library(ggforce)
library(kableExtra)
library(rpart)
library(rpart.plot)
library(data.table)
Here’s a preview of the data I’m working with. It’s the same EMS data (with different aggregations) from my EMS Flexdashboard post.
https://jbrnbrg.