Forecast a single 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 for a given column based on the historical values
for that column.
This tutorial forecasts a single time series. Forecasted values are
calculated once for each time point in the input data.
Retrieving the forecasted site traffic 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 the following:
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.
Follow these steps to visualize the time series data:
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.
Theauto.ARIMAalgorithm uses theKPSS testto determine the best value
fornon_seasonal_d, which in this case is1. Whennon_seasonal_dis1,
theauto.ARIMAalgorithm 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 the best model. The best model is saved as the final
model and is used when you call functions such asML.FORECASTon the model
Theseasonal_periodscolumn contains information about the seasonal pattern
identified in the time series data. It has nothing to do with the ARIMA
modeling, therefore it has the same value across all output rows. It reports a
weekly pattern, which agrees with the results you saw if you chose to
visualize the input data.
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.
Theerror_messagecolumn shows any errors that incurred during theauto.ARIMAfitting process. One possible reason for errors is when the selectednon_seasonal_p,non_seasonal_d,non_seasonal_q, andhas_driftcolumns
are not able to stabilize the time series. To retrieve the error
message of all the candidate models, set theshow_all_candidate_modelsoption toTRUEwhen you create the model.
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.
If you would like to visualize the results, you can use
Data Studio as described in theVisualize the input datasection to create a chart, using the following columns as metrics:
time_series_data
prediction_interval_lower_bound
prediction_interval_upper_bound
trend
seasonal_period_weekly
step_changes
Clean up
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-29 UTC."],[],[]]