Using TimeGPT for time series forecasting in the R programming language
IntroductionTimeGPT-1: The first foundation model for time series forecasting and anomaly detection. Thenixtlar
package is the R interface to TimeGPT, allowing you to perform state-of-the-art time series forecasting directly from R. TimeGPT is a production-ready, generative pretrained transformer for time series forecasting, developed by Nixtla. It is capable of accurately predicting various domains such as retail, electricity, finance, and IoT, with just a few lines of code. Additionally, it can detect anomalies in time series data.
Version 0.6.2 of nixtlar is now available on CRAN! This version introduces support for TimeGEN-1, TimeGPT optimized for Azure, along with enhanced date support, business-day frequency inference, and various bug fixes.
How to useTo learn how to usenixtlar
, please refer to the documentation. To view directly on CRAN, please use this link. Installation
# Install nixtlar from CRAN
install.packages("nixtlar")
# Then load it
library(nixtlar)
# Set your API key
nixtla_set_api_key(api_key = "Your API key here")
Quick Example
# Load sample data
df <- nixtlar::electricity
head(df)
# Forecast the next 8 steps ahead
nixtla_client_fcst <- nixtla_client_forecast(df, h = 8, level = c(80,95))
# Optionally, plot the results
nixtla_client_plot(df, nixtla_client_fcst, max_insample_length = 200)
Anomaly Detection Example
# Detect anomalies
nixtla_client_anomalies <- nixtlar::nixtla_client_detect_anomalies(df)
# Plot with anomalies highlighted
nixtlar::nixtla_client_plot(df, nixtla_client_anomalies, plot_anomalies = TRUE)
Features and CapabilitiesTimeGPT through the nixtlar
package provides:
Garza, A., Challu, C., & Mergenthaler-Canseco, M. (2024). TimeGPT-1.
arXiv preprint arXiv:2310.03589. Available at
https://arxiv.org/abs/2310.03589
SupportIf you have questions or need support, please email support@nixtla.io
. TimeGPT is closed source. However, this SDK is open source and available under the Apache 2.0 License.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4