Hands-On Time Series Analysis with R
eBook - ePub

Hands-On Time Series Analysis with R

Perform time series analysis and forecasting using R

Rami Krispin

Partager le livre
  1. 448 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Hands-On Time Series Analysis with R

Perform time series analysis and forecasting using R

Rami Krispin

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

Build efficient forecasting models using traditional time series models and machine learning algorithms.

Key Features

  • Perform time series analysis and forecasting using R packages such as Forecast and h2o
  • Develop models and find patterns to create visualizations using the TSstudio and plotly packages
  • Master statistics and implement time-series methods using examples mentioned

Book Description

Time series analysis is the art of extracting meaningful insights from, and revealing patterns in, time series data using statistical and data visualization approaches. These insights and patterns can then be utilized to explore past events and forecast future values in the series.

This book explores the basics of time series analysis with R and lays the foundations you need to build forecasting models. You will learn how to preprocess raw time series data and clean and manipulate data with packages such as stats, lubridate, xts, and zoo. You will analyze data and extract meaningful information from it using both descriptive statistics and rich data visualization tools in R such as the TSstudio, plotly, and ggplot2 packages. The later section of the book delves into traditional forecasting models such as time series linear regression, exponential smoothing (Holt, Holt-Winter, and more) and Auto-Regressive Integrated Moving Average (ARIMA) models with the stats and forecast packages. You'll also cover advanced time series regression models with machine learning algorithms such as Random Forest and Gradient Boosting Machine using the h2o package.

By the end of this book, you will have the skills needed to explore your data, identify patterns, and build a forecasting model using various traditional and machine learning methods.

What you will learn

  • Visualize time series data and derive better insights
  • Explore auto-correlation and master statistical techniques
  • Use time series analysis tools from the stats, TSstudio, and forecast packages
  • Explore and identify seasonal and correlation patterns
  • Work with different time series formats in R
  • Explore time series models such as ARIMA, Holt-Winters, and more
  • Evaluate high-performance forecasting solutions

Who this book is for

Hands-On Time Series Analysis with R is ideal for data analysts, data scientists, and all R developers who are looking to perform time series analysis to predict outcomes effectively. A basic knowledge of statistics is required; some knowledge in R is expected, but not mandatory.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Hands-On Time Series Analysis with R est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Hands-On Time Series Analysis with R par Rami Krispin en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Data Processing. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2019
ISBN
9781788624046
Édition
1
Sous-sujet
Data Processing

Forecasting with ARIMA Models

The Autoregressive Integrated Moving Average (ARIMA) model is the generic name for a family of forecasting models that are based on the Autoregressive (AR) and Moving Average (MA) processes. Among the traditional forecasting models (for example, linear regression, exponential smoothing, and so on), the ARIMA model is considered as the most advanced and robust approach. In this chapter, we will introduce the model components—the AR and MA processes and the differencing component. Furthermore, we will focus on methods and approaches for tuning the model's parameters with the use of differencing, the autocorrelation function (ACF), and the partial autocorrelation function (PACF).
In this chapter, we will cover the following topics:
  • The stationary state of time series data
  • The random walk process
  • The AR and MA processes
  • The ARMA and ARIMA models
  • The seasonal ARIMA model
  • Linear regression with the ARIMA errors model

Technical requirement

The following packages will be used in this chapter:
  • forecast: Version 8.5 and above
  • TSstudio: Version 0.1.4 and above
  • plotly: Version 4.8 and above
  • dplyr: Version 0.8.1 and above
  • lubridate: Version 1.7.4 and above
  • stats: Version 3.6.0 and above
  • datasets: Version 3.6.0 and above
  • base: Version 3.6.0 and above
You can access the codes for this chapter from the following link:
https://github.com/PacktPublishing/Hands-On-Time-Series-Analysis-with-R/tree/master/Chapter11

The stationary process

One of the main assumptions of the ARIMA family of models is that the input series follows the stationary process structure. This assumption is based on the Wold representation theorem, which states that any stationary process can be represented as a linear combination of white noise. Therefore, before we dive into the ARIMA model components, let's pause and talk about the stationary process. The stationary process, in the context of time series data, describes a stochastic state of the series. Time series data is stationary if the following conditions are taking place:
  • The mean and variance of the series do not change over time
  • The correlation structure of the series, along with its lags, remains the same over time
In the following examples, we will utilize the arima.sim function from the stats package to simulate a stationary and non-stationary time series data and plot it with the ts_plot function from the TSstudio package. The arima.sim function allows us to simulate time series data based on the ARIMA model's components and main characteristics:
  • An Autoregressive (AR) process: Establish a relationship between the series and its past p lags with the use of a regression model (between the series and its p lags)
  • A Moving Average (MA) process: Similar to the AR process, the MA process establishes the relationship with the error term at time t and the past error terms, with the use of regression between the two components (error at time t and the past error terms)
  • Integrated (I) process: The process of differencing the series with its d lags to transform the series into a stationary state
Here, the model argument of the function defines p, q, and d, as well as the order of the AR, MA, and I processes of the model. For now, don't worry if you are not familiar with this function—we will discuss it in detail later in this chapter.
The arima.sim function has a random component. Therefore, in order to be able to reproduce the examples throughout this chapter, we will use the set.seed function. The set.seed function allows you to create random numbers in a reproducible manner in R by setting the random generating seed value.
For instance, in the following example, we will simulate an AR process with one lag (that is, p = 1) and 500 observations with the arima.sim function. Before running the simulation, we will set the seed value to 12345:
set.seed(12345)

stationary_ts <- arima.sim(model = list(order = c(1,0,0),
ar = 0.5 ),
n = 500)
Now, let's plot the simulate time series with the ts_plot function:
library(TSstudio)

ts_plot(stationary_ts,
title = "Stationary Time Series",
Ytitle = "Value",
Xtitle = "Index")
We get the following output:
In this case, you can see that, ...

Table des matiĂšres