Forecast multiple time series with an ARIMA_PLUS univariate modelStay organized with collectionsSave and categorize content based on your preferences.
This tutorial teaches you how to use anARIMA_PLUSunivariate time series modelto forecast the future value of a given
column, based on the historical values for that column.
This tutorial forecasts for multiple time series. Forecasted values are
calculated for each time point, for each value in one or more specified columns.
For example, if you wanted to forecast weather and specified a column containing
city data, the forecasted data would contain forecasts for all time points for
City A, then forecasted values for all time points for City B, and so forth.
Retrieving the forecasted bike ride information from the model by using theML.FORECASTfunction.
Retrieving components of the time series, such as seasonality and trend,
by using theML.EXPLAIN_FORECASTfunction.
You can inspect these time series components in order to explain the
forecasted values.
Costs
This tutorial uses billable components of Google Cloud, including:
BigQuery
BigQuery ML
For more information about BigQuery costs, see theBigQuery pricingpage.
Sign in to your Google Cloud account. If you're new to
Google Cloud,create an accountto evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant
roles.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant
roles.
BigQuery is automatically enabled in new projects.
To activate BigQuery in a pre-existing project, go to
Enable the BigQuery API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM
role (roles/serviceusage.serviceUsageAdmin), which
contains theserviceusage.services.enablepermission.Learn how to grant
roles.
Before creating the model, you can optionally visualize your input
time series data to get a sense of the distribution. You can do this by using
Data Studio.
You want to forecast the number of bike trips for each Citi Bike station, which requires many time series models; one for each Citi Bike station that is included in the input data. You can create multiple models to do this, but that can be a tedious and time-consuming process, especially when you have a large number of time series. Instead, you can use a single query to create and fit a set of time series models in order to forecast multiple time series at once.
Thestart_station_namecolumn identifies the input data column for which
time series were created. This is the column that you specified with thetime_series_id_coloption when creating the model.
Thenon_seasonal_p,non_seasonal_d,non_seasonal_q, andhas_driftoutput columns define an ARIMA model in the training pipeline. Thelog_likelihood,AIC, andvarianceoutput columns are relevant to the ARIMA
model fitting process. The fitting process determines the best ARIMA model by
using theauto.ARIMAalgorithm, one for each time series.
Theauto.ARIMAalgorithm uses theKPSS testto determine the best value
fornon_seasonal_d, which in this case is1. Whennon_seasonal_dis1,
the auto.ARIMA algorithm trains 42 different candidate ARIMA models in parallel.
In this example, all 42 candidate models are valid, so the output contains 42
rows, one for each candidate ARIMA model; in cases where some of the models
aren't valid, they are excluded from the output. These candidate models are
returned in ascending order by AIC. The model in the first row has the lowest
AIC, and is considered as the best model. This best model is saved as the final
model and is used when you forecast data, evaluate the model, and
inspect the model's coefficients as shown in the following steps.
Theseasonal_periodscolumn contains information about the seasonal pattern
identified in the time series data. Each time series can have different seasonal
patterns. For example, from the figure, you can see that one time series has a
yearly pattern, while others don't.
Thehas_holiday_effect,has_spikes_and_dips, andhas_step_changescolumns
are only populated whendecompose_time_series=TRUE. These columns also reflect
information about the input time series data, and are not related to the ARIMA
modeling. These columns also have the same values across all output rows.
Thestart_station_namecolumn identifies the input data column for which
time series were created. This is the column that you specified in thetime_series_id_coloption when creating the model.
Thear_coefficientsoutput column shows the model coefficients of the
autoregressive (AR) part of the ARIMA model. Similarly, thema_coefficientsoutput column shows the model coefficients of the moving-average (MA) part of
the ARIMA model. Both of these columns contain array values, whose lengths are
equal tonon_seasonal_pandnon_seasonal_q, respectively. Theintercept_or_driftvalue is the constant term in the ARIMA model.
The first column,start_station_name, annotates the time series that each
time series model is fitted against. Eachstart_station_namehas three
rows of forecasted results, as specified by thehorizonvalue.
For eachstart_station_name, the output rows are in chronological order by theforecast_timestampcolumn value. In time series forecasting, the prediction
interval, as represented by theprediction_interval_lower_boundandprediction_interval_upper_boundcolumn values, is as important as theforecast_valuecolumn value. Theforecast_valuevalue is the middle point
of the prediction interval. The prediction interval depends on thestandard_errorandconfidence_levelcolumn values.
To avoid incurring charges to your Google Cloud account for the resources used in this
tutorial, either delete the project that contains the resources, or keep the project and
delete the individual resources.
You can delete the project you created.
Or you can keep the project and delete the dataset.
Delete your dataset
Deleting your project removes all datasets and all tables in the project. If you
prefer to reuse the project, you can delete the dataset you created in this
tutorial:
If necessary, open the BigQuery page in the
Google Cloud console.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-05-08 UTC."],[],[]]