What is TBATS model in time series in R How to use it

This recipe explains what is TBATS model in time series in R This recipe helps you use it

Recipe Objective

What is TBATS model in time series? How to use it

Time series is a statistical technique that deals with time series data or trend analysis. Time series data means the data is collected over a period of time/ intervals. Time series data helps us with making forecasting based on the previously collected data. TBATS is a time series model that is useful for handling data with multiple seasonal patterns, i.e., the data that changes over time. The TBATS is preferred over BATS as the Trigonometric seasonality (TBATS) can deal with complex and high frequency. TBATS is an acronym for key features of the model: T: Trigonometric seasonality B: Box-Cox transformation A: ARIMA errors T: Trend S: Seasonal components This recipe demonstrates an example of TBATS modelling of time series.

Get Access to Time Series Analysis Real World Projects in Python

Step 1 - Install required package

install.packages('forecast') library(forecast)

Step 2 - Generate random time series data

# Get the data points in form of a R vector. rain <- c(987,1025,978,774,1563,569,1456,789,1479,566,1563,1698) # Convert it to a time series object. rain_ts <- ts(rain,start = c(2020,1),frequency = 12) # Print the timeseries data. print(rain_ts) plot(rain_ts, main = "Time series data") summary(rain_ts)

Step 3 - Plot a trend line

plot(rain_ts) abline(reg=lm(rain_ts~time(rain_ts)))

Step 4 - Build a model using tbats()

model_tbats <- tbats(rain_ts) summary(model_tbats)

Step 5 - Make predictions with the model

predict <- predict(model_tbats) predict predict_val<- forecast(model_tbats, level=c(95), h = 6) # forecast for 2021.0 till 2021.6 i.e 6 months plot(predict_val) {"mode":"full","isActive":false}

What Users are saying..

profile image

Gautam Vermani

Data Consultant at Confidential
linkedin profile url

Having worked in the field of Data Science, I wanted to explore how I can implement projects in other domains, So I thought of connecting with ProjectPro. A project that helped me absorb this topic... Read More

Relevant Projects

Build Multi Class Text Classification Models with RNN and LSTM
In this Deep Learning Project, you will use the customer complaints data about consumer financial products to build multi-class text classification models using RNN and LSTM.

Build a Graph Based Recommendation System in Python-Part 2
In this Graph Based Recommender System Project, you will build a recommender system project for eCommerce platforms and learn to use FAISS for efficient similarity search.

LLM Project to Build and Fine Tune a Large Language Model
In this LLM project for beginners, you will learn to build a knowledge-grounded chatbot using LLM's and learn how to fine tune it.

Build CNN for Image Colorization using Deep Transfer Learning
Image Processing Project -Train a model for colorization to make grayscale images colorful using convolutional autoencoders.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Time Series Forecasting Project-Building ARIMA Model in Python
Build a time series ARIMA model in Python to forecast the use of arrival rate density to support staffing decisions at call centres.

Insurance Pricing Forecast Using XGBoost Regressor
In this project, we are going to talk about insurance forecast by using linear and xgboost regression techniques.

Learn to Build Generative Models Using PyTorch Autoencoders
In this deep learning project, you will learn how to build a Generative Model using Autoencoders in PyTorch

Image Segmentation using Mask R-CNN with Tensorflow
In this Deep Learning Project on Image Segmentation Python, you will learn how to implement the Mask R-CNN model for early fire detection.

Langchain Project for Customer Support App in Python
In this LLM Project, you will learn how to enhance customer support interactions through Large Language Models (LLMs), enabling intelligent, context-aware responses. This Langchain project aims to seamlessly integrate LLM technology with databases, PDF knowledge bases, and audio processing agents to create a comprehensive customer support application.