DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • The LLM Advantage: Smarter Time Series Predictions With Less Effort
  • Optimizing Prometheus Queries With PromQL
  • Utilizing AI and Database Technologies to Stimulate Innovation
  • How to Enable Azure Databricks Lakehouse Monitoring Through Scripts

Trending

  • Stabilizing ETL Pipelines With Airflow, Presto, and Metadata Contracts
  • Understanding N-Gram Language Models and Perplexity
  • The AWS Playbook for Building Future-Ready Data Systems
  • 10 Predictions Shaping the Future of Web Data Extraction Services
  1. DZone
  2. Data Engineering
  3. Databases
  4. Time Series Analysis: Developing the Intuition

Time Series Analysis: Developing the Intuition

Time series data exhibits a linear trend over time or has a seasonal effect. How does this have an impact on how it's analyzed to predict the future?

By 
Sunil Kappal user avatar
Sunil Kappal
·
Jan. 23, 18 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
5.6K Views

Join the DZone community and get the full member experience.

Join For Free

A time series can be defined as a sequence of measurements taken over time at a regular interval (most often). Another important aspect of time series is its ordering, as it is highly dependent on the way it's been ordered. And because of its dependency, changing the order could also change the meaning of the data.

The theory for time series is based on the assumption of second-order stationarity. Real-life data are often not stationary; they exhibit a linear trend over time, or they have a seasonal effect.

What Is the Objective of Any Time Series Analysis?

The basic objective of time series analysis is to determine a model that can describe the pattern of the time series data to answer questions like:

  • What are the important features of the time series pattern?
  • How well does the past explain the future?
  • Can we forecast the future based on the historic time series?

Time series can also be described as a set of statistics, collected at regular intervals. Time series data occurs naturally in many areas:

  • Economics: Monthly unemployment data, hospital admissions
  • Healthcare: Daily claim submissions, denials, rework
  • Environmental: Daily air quality, rainfall

The Classical Decomposition of Time Series

One simple method of defining a time series is the notion of decomposing it into four main elements:

  1. Trend (Tt): Long-term movements in the mean.
  2. Seasonal Effect (It): Calendar-related cyclical fluctuations.
  3. Cycles (Ct): Business cycle-related fluctuations.
  4. Residuals (Et): Random or systematic fluctuations.

The thought behind the above elements is to create separate models for each of them and then combine them either additively or multiplicatively.

To choose when to combine the elements via additive or multiplicative methods, keep the following points in mind:

  • If the magnitude of the seasonal component is relatively constant regardless of changes in the trend, an additive model is suitable.
  • If it varies with changes in the trend, a multiplicative model is suitable.

However, if the series contains values close or equal to zero and the magnitude of the seasonal component appears to be dependent on the trend level, then the pseudo-additive model is most appropriate.

Types of Time Series Models

  • AR model (autoregressive model): This type of model can forecast the future value based on its immediate prior value within the time series. This type of model is considered as a linear model.

  • MA model (moving average models (MA): These are very different from the auto-regressive models and is always stationary. An MA model specifies that the output variable depends linearly on the current and various past values of the random term. The moving average term in a time series model is a past error (multiplied by coefficient).

  • ARIMA model (autoregressive integrates moving average model): As the name suggests, it is a combination of the above two modeling techniques that keeps the below-listed scenarios in mind:

    • When a model involves only autoregressive terms, it's an AR model.
    • When a model involves only moving average terms, it's an MA model.

The ARIMA model is also known as Box-Jenkins model that may include auto-regressive, moving average terms.

Note: It is worth mentioning that within ARIMA, there are seasonal and non-seasonal models that can be further studied to gain a solid understanding of various time series models.

Now that we have gained some basic understanding of the time series analysis, it's a good idea to look at how to perform time series analysis or modeling activity. The forecasting process using the time series methods is a set of connected activities that transforms one or more inputs into one or more outputs. The activities are as follows:

  • Problem definition: This activity involves developing an understanding with regard to how the forecast will be consumed along with the expectations of the customer/client/end user). It is believed that the success of any forecasting model depends on how well the model predicts and is aligned with the client's expectations captured during this phase.

  • Data collection: Data collection consists of obtaining the relevant history for the variable(s) that are to be forecast, including historical information on potential predictor variables. The key here is "relevant" — often, it is necessary to deal with missing values of some variables, potential outliers, or other data-related problems that have occurred in the past.

  • Data analysis: This phase is a very important preliminary step to select the most effective forecasting model. Any potential outliers should be identified and flagged during this phase itself. Numerical summaries like sample mean, standard deviation, percentiles, and autocorrelations should be evaluated during this phase.

  • Model selection and fitting: This phase consists of choosing one or more forecasting models and fitting the model to the data. Fitting in this context means estimating the unknown model parameters by implementing the least square methods.

  • Model validation: This consists of evaluating how well the model is forecasting and should be able to showcase the magnitude of forecast error when it will be used to forecast fresh or new data. The fitting errors will always be less than the forecast errors.

Lastly, some common forecast accuracy evaluation statistics:

  • ME: Mean error
  • MAD: Mean absolute deviation
  • MSE: Mean squared error
  • MAPE: Mean absolute percentage error
Time series Intuition (Bergson)

Published at DZone with permission of Sunil Kappal, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • The LLM Advantage: Smarter Time Series Predictions With Less Effort
  • Optimizing Prometheus Queries With PromQL
  • Utilizing AI and Database Technologies to Stimulate Innovation
  • How to Enable Azure Databricks Lakehouse Monitoring Through Scripts

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: