Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

## Econometric Modeler App Overview

The Econometric Modeler app is an interactive tool for analyzing univariate time series data. The app is well suited for visualizing and transforming data, performing statistical specification and model identification tests, fitting models to data, and iterating among these actions. When you are satisfied with a model, you can export it to the MATLAB® Workspace to forecast future responses or for further analysis. You can also generate code or a report from a session.

Start Econometric Modeler by entering `econometricModeler` at the MATLAB command line, or by clicking under Computational Finance in the apps gallery (Apps tab on the MATLAB Toolstrip).

The following workflow describes how to find a model with the best in-sample fit to time series data using Econometric Modeler. The workflow is not a strict prescription—the steps you implement depend on your goals and the model type. You can easily skip steps and iterate several steps as needed. The app is well suited to the Box-Jenkins approach to time series model building [1].

1. Prepare data for Econometric Modeler — Select a response variable to analyze and from which to build a predictive model. Optionally, select explanatory variables to include in the model.

### Note

You can import only one variable from the MATLAB Workspace into Econometric Modeler. Therefore, at the command line, you must synchronize and concatenate multiple series into one variable.

2. Import time series variables — Import Data into Econometric Modeler from the MATLAB Workspace or a MAT-file. After importing data, you can adjust variable properties or the presence of variables.

3. Perform exploratory data analysis — View the series in various ways, stabilize a series by transforming it, and detect time series properties by performing statistical tests.

• Visualize time series data — Supported plots include time series plots and correlograms (for example, the autocorrelation function (ACF)).

• Perform specification and model identification hypothesis tests — Test series for stationarity, heteroscedasticity, autocorrelation, and collinearity among multiple series. For ARIMA and GARCH models, this step can include determining the appropriate number of lags to include in the model. Supported tests include the augmented Dickey-Fuller test, Engle's ARCH test, the Ljung-Box Q-test, and Belsley collinearity diagnostics.

• Transform time series — Supported transformations include the log transformation and seasonal and nonseasonal differencing.

4. Fit candidate models to the data — Choose model parametric forms for a univariate response series based on the exploratory data analysis or dictated by economic theory. Then, estimate the model. Supported models include seasonal and nonseasonal conditional mean (for example, ARIMA), conditional variance (for example, GARCH), and multiple linear regression models (optionally containing ARMA errors).

5. Conduct goodness-of-fit checks — Ensure that the model adequately describes the data by performing residual diagnostics.

• Visualize the residuals to check whether they are centered on zero, normally distributed, homoscedastic, and serially uncorrelated. Supported plots include quantile-quantile and ACF plots.

• Test the residuals for homoscedasticity and autocorrelation. Supported tests include the Ljung-Box Q-test and Engle's ARCH test on the squared residuals.

6. Find the model with the best in-sample fit — Estimate multiple models within the same family, and then choose the model that yields the minimal fit statistic, for example, Akaike information criterion (AIC).

7. Export session results — After you find a model or models that perform adequately, summarize the results of the session. The method you choose depends on your goals. Supported methods include:

• Export variables — Econometric Modeler exports selected variables to the MATLAB Workspace. If a session in the app does not complete your analysis goal, such as forecasting responses, then you can export variables (including estimated models) for further analysis at the command line.

• Generate a function — Econometric Modeler generates a MATLAB plain text or live function that returns a selected model given the imported data. This method helps you understand the command-line functions that the app uses to create predictive models. You can modify the generated function to accomplish your analysis goals.

• Generate a report — Econometric Modeler produces a document, such as, a PDF, describing your activities on selected variables or models. This method provides a clear and convenient summary of your analysis when you complete your goal in the app.

### Prepare Data for Econometric Modeler App

You can import only one variable from the MATLAB Workspace into Econometric Modeler. Therefore, before importing data, concatenate the response series and any predictor series into one variable.

Econometric Modeler supports these variable data types.

• MATLAB timetable — Variables must be double-precision numeric vectors. A best practice is to import your data in a timetable because Econometric Modeler:

• Names variables by using the names stored in the `VariableNames` field of the `Properties` property.

• Uses the time variable values as tick labels for any axis that represents time. Otherwise, tick labels representing time are indices.

• Enables you to overlay recession bands on time series plots (see `recessionplot`)

• MATLAB table — Variables must be double-precision numeric vectors. Variable names are the names in the `VariableNames` field of the `Properties` property.

• Numeric vector or matrix — For a matrix, each column is a separate variable named `variableNamej`, where `j` is the corresponding column.

Regardless of variable type, Econometric Modeler assumes that rows correspond to time points (observations).

### Import Time Series Variables

The data set can exist in the MATLAB Workspace or in a MAT-file that you can access from your machine.

• To import a data set from the Workspace, on the Econometric Modeler tab, in the Import section, click . In the Import Data dialog box, click the check box in the Import? column for the variable containing the data, and then click . All variables in the Workspace of the supported data type appear in the dialog box, but you can choose one only.

• To import data from a MAT-file, in the Import section, click , then select `Import From MAT-file`. In the Select a MAT-file dialog box, browse to the folder containing the data set, then double-click the MAT-file.

After you import data, the name of each variable (column) in the data set appears in the Time Series section of the Data Browser. Also, a time series plot including all variables appears in the Time Series Plot(`VariableName`) figure window, where `VariableName` is the name of one of the variables in the Data Browser.

You can interact with the variables in the Data Browser in several ways.

• To select a variable to perform a statistical test or create a plot, for example, click the variable in the Data Browser. If you double-click the variable instead, then the app also plots it in a separate time series plot.

• To change a variable name or delete a variable, right-click it in the Data Browser. Then, from the context menu, choose the desired action.

• To operate on multiple time series simultaneously, press Ctrl and click each variable you want to use.

Consider importing the data in the `Data_USEconModel` MAT-file.

1. At the command line, load the data into the Workspace.

`load Data_USEconModel`
2. In Econometric Modeler, in the Import section of the Econometric Modeler tab, click . The Import Data dialog box appears.

3. `Data_USEconModel` stores several variables. DataTable and Data contain the same data, but DataTable is a timetable that attributes names to variables and sampling times to rows. Import DataTable by selecting the corresponding Import? check box, then clicking .

All variables in DataTable appear in the Data Browser. Suppose that you want to retain `COE`, `FEDFUNDS`, and `GDP` only. Select all other variables, right-click one of them, and select Delete.

After working in the app, you can import another data set. After you click , Econometric Modeler displays the following dialog box.

If you click , then Econometric Modeler deletes all variables from the Data Browser, and closes all documents in the right pane.

### Perform Exploratory Data Analysis

An exploratory data analysis includes determining characteristics of your variables and relationships between them, with the formation of a predictive model in mind. For time series data, identify series that grow exponentially, contain trends, or are nonstationary, and then transform them appropriately. For ARIMA models, to identify the model form and significant lags in the serial correlation structure of the response series, use the Box-Jenkins methodology [1]. If you plan to create GARCH models, then assess whether the series contain volatility clustering and significant lags. For multiple regression models, identify collinear predictors and those predictors that are linearly related to the response.

For time series data analysis, an exploratory analysis usually includes iterating among visualizing the data, performing statistical specification and model identification tests, and transforming the data.

#### Visualizing Time Series Data

After you import a data set, Econometric Modeler selects all variables in the imported data and displays a time series plot of them in the right pane by default. For example, after you import `DataTable` in the `Data_USEconModel` data set, the app displays this time series plot.

To create your own time series plot:

1. In the Data Browser, select the appropriate number of series for the plot.

2. Click the Plots tab in the toolstrip.

3. Click the button for the type of plot you want.

Econometric Modeler supports the following time series plots.

PlotGoals

Time series or

• Identify missing values or outliers.

• Identify series that grow exponentially or that contain a trend.

• Identify nonstationary series.

• Identify series that contain volatility clustering.

• Compare two series with different scales in the same plot (```Y-Y Axis```).

• Compare multiple series with similar scales in the same plot.

Autocorrelation function (ACF)

• Identify series with serial correlation.

• Determine whether an AR model is appropriate.

• Identify significant MA lags for model identification.

Partial ACF (PACF)

• Identify series with serial correlation.

• Determine whether an MA model is appropriate.

• Identify significant AR lags for model identification.

Correlations

• Inspect variable distributions.

• Identify variables with linear relationships pairwise.

You can interact with an existing plot by:

• Right-clicking it

• Using the plot buttons that appear when you pause on the plot

• Using the options on the figure window

Supported interactions vary by plot type.

• Save a figure — Right-click the figure, then select Export. Save the figure that appears.

• Add or remove time series in a plot — Right-click the figure, point to Show Time Series menu, then select the time series to add or remove.

• Plot recession bands — Right-click a time series plot, then select Show Recessions.

• Zoom — Pause on the figure. To zoom in, click . To zoom out, click . For more details, see Zoom, Pan, and Rotate Data (MATLAB).

• Pan — Pause on the figure, then click . For more details on panning, see Zoom, Pan, and Rotate Data (MATLAB).

• Toggle legend — Pause on the figure, then click .

• Show grid lines — Pause on the figure, then click .

For serial correlation function plots, additional options exist in the ACF or PACF tabs. You can specify the:

• Number of lags to display

• Number of standard deviations for the confidence bands

• MA or AR order in which the theoretical ACF or PACF, respectively, is effectively zero

Econometric Modeler updates the plot in real time as you adjust the parameters.

To view multiple plots simultaneously, you can orient plot tabs by dragging them into different sections of the right pane. As you drag a plot, the app highlights possible sections in which to place it. To undo the last document or figure window positioning, pause on the dot located in the middle of the partition, then click when it appears.

Consider an ARIMA model for the effective federal funds rate (`FEDFUNDS`). To identify the model characteristics (for example, the number of AR or MA lags), plot the time series, ACF, and PACF side-by-side.

1. In the Data Browser, double-click `FEDFUNDS`.

2. Add recession bands to the plot by right-clicking the plot in the Time Series Plot(FEDFUNDS) figure window, then selecting Show Recessions.

3. On the Plots tab, click .

4. Click .

5. Click the Time Series Plot(FEDFUNDS) figure window and drag it to the left side of the right pane. Click the PACF(FEDFUNDS) figure window and drag it to the bottom right of the pane.

The ACF dies out slowly and the PACF cuts off after the first lag. The behavior of the ACF suggests that the time series must be transformed before you choose on the form of the ARIMA model.

In the right pane, observe the dot in the middle of the horizontal partition between the correlograms (below the Lag x axis label of the ACF). To undo this correlogram positioning, that is, separate the correlograms by tabs, pause on the dot and click when it appears.

#### Performing Specification and Model Identification Hypothesis Tests

You can perform hypothesis tests to confirm time series properties that you obtain visually or test for properties that are difficult to see. Econometric Modeler supports these tests for univariate series.

TestHypotheses

Augmented Dickey-Fuller

H0: Series has a unit root.

H1: Series is stationary.

For details on the supported parameters, see `adftest`.

Kwiatkowski, Phillips, Schmidt, Shin (KPSS)

H0: Series is trend stationary.

H1: Series has a unit root.

For details on the supported parameters, see `kpsstest`.

Leybourne-McCabe

H0: Series is a trend stationary AR(p) process.

H1: Series is an ARIMA(p,1,1) process.

To specify p, adjust the Number of Lags parameter. For details on the supported parameters, see `lmctest`.

Phillips-Peron

H0: Series has a unit root.

H1: Series is stationary.

For details on the supported parameters, see `pptest`.

Variance ratio

H0: Series is a random walk.

H1: Series is not a random walk.

For details on the supported parameters, see `vratiotest`.

Engle's ARCH

H0: Series exhibits no conditional heteroscedasticity (ARCH effects).

H1: Series is an ARCH(p) model, with p > 0.

To specify p, adjust the Number of Lags parameter. For details on the supported parameters, see `archtest`.

Ljung-Box Q-test

H0: Series exhibits no autocorrelation in the first m lags, that is, corresponding coefficients are jointly zero.

H1: Series has at least one nonzero autocorrelation coefficient ρj, j ∈ {1,…,m}.

To specify m, adjust the Number of Lags parameter. For details on the supported parameters, see `lbqtest`.

### Note

Before conducting tests, Econometric Modeler removes leading and trailing missing values (`NaN` values) in the series. Engle's ARCH test does not support missing values within the series, that is, `NaN` values preceded and succeeded by observations.

The stationarity test results suggest whether you should transform a series to stabilize it, and which transformation is appropriate. For ARIMA models, stationarity test results suggest whether to include degrees of integration. Engle's ARCH test results indicate whether the series exhibits volatility clustering and suggests lags to include in a GARCH model. Ljung-Box Q-test results suggest how many AR lags are required in an ARIMA model.

To perform a univariate test in Econometric Modeler:

1. Select a variable in the Data Browser.

2. On the Econometric Modeler tab, in the Tests section, click .

3. In the test gallery, click the test you want to conduct. A new tab for the test type appears in the toolstrip, and a new document for the test results appears in the right pane.

4. On the test type tab, in the Parameters section, adjust parameters for the test. For example, consider performing an Engle's ARCH test. On the ARCH tab, in the Parameters section, select the number of lags in the test statistic using the Number of Lags spin box, or the significance level (that is, the value of α) using the Significance Level spin box.

5. On the test-type tab, in the Tests section, click . The test results, including whether to reject the null hypothesis, the p-value, and the parameter settings, appear in a new row in the Results table of the test results document. If the null hypothesis has been rejected, then the app highlights the row in yellow.

You can adjust parameters and run the test multiple times. The results from each test run for a particular variable appear as a new row in the Results table. To remove a row from the Results table, select the corresponding check box in the Select column, then click in the test-type tab.

### Note

Multiple testing inflates the false discovery rate. One conservative way to maintain an overall false discovery rate of α is to apply the Bonferroni correction to the significance level of each test. That is, for a total of t tests, set Significance Level value to α/t.

For multiple series, you can assess the strength and sources of collinearity among the series using the Belsley collinearity diagnostics . To perform Belsley correlation diagnostics:

1. Select at least two variables in the Data Browser.

2. On the Econometric Modeler tab, in the Tests section, click .

3. In the tests gallery, in the Collinearity section, click . A new tab for Belsley collinearity diagnostics appears in the toolstrip, and a new document for the results appears in the right pane.

4. On the Collinearity tab, in the Tolerances section, adjust parameters for the test. The app performs diagnostics in real time as you adjust parameter values.

Econometric Modeler returns a table of the singular values, condition indices, and the variance-decomposition proportions for each variable. Rows Econometric Modeler highlights in yellow have a condition index greater than the tolerance specified by the Condition Index parameter value in the Tolerances section of the Collinearity tab. Also, Econometric Modeler plots the variance-decomposition proportions for the highlighted rows for each variable.

In the highlighted rows, those variables with variance-decomposition greater than the tolerance (or, those variables with red markers in the plot) exhibit multicollinearity. For more details on the Belsley collinearity diagnostics results and multicollinearity, see `collintest` and Time Series Regression II: Collinearity and Estimator Variance.

To add or remove time series from the diagnostics:

1. In the test-results document, right-click the Results table or plot.

2. Point to Show Time Series. A list of all variables appears.

3. Click a variable to add it to the diagnostics, or click a selected variable to remove it from the diagnostics.

Consider a predictive model containing Canadian inflation and interest rates as predictor variables. Determine whether the variables are collinear. The `Data_Canada` data set contains the time series.

1. Import the `DataTable` variable in the `Data_Canada` data set into Econometric Modeler (see Import Time Series Variables). The time series plot appears in the right pane.

All series appear to contain autocorrelation. Although you should remove autocorrelation from predictor variables before creating a predictive model, this example proceeds without removing autocorrelation.

2. In the Tests section, click New Test. In the Collinearity section, click .

Econometric Modeler creates a document containing the Belsley collinearity diagnostics results.

The condition index and variance-decomposition proportion tolerance defaults are `30` and `0.5`, respectively. Because their variance-decomposition proportions are above the tolerance for the condition index, the collinear predictors are `INT_L`, `INT_M`, and `INT_S`.

#### Transforming Time Series

The Box-Jenkins methodology [1] for ARIMA model selection assumes that the response series is stationary, and spurious regression models can result from a model containing nonstationary predictors and response variables (for more details, see Time Series Regression IV: Spurious Regression). To stabilize your series, Econometric Modeler supports these transformations in the Transforms section of the Econometric Modeler tab.

TransformationUse When Series ...Notes

Log

Has an exponential trend or variance that grows with its levelsAll values in the series must be positive.

Linear detrend

Has a linear deterministic trend that can be identified using least squares

When Econometric Modeler detrends the series, it ignores leading or trailing missing (`NaN`) values.

If any missing values occur between observed values, then the app returns a vector of `NaN` values with length equal to the series.

First-order difference

Has a stochastic trendEconometric Modeler prepends the differenced series with a `NaN` value. This action ensures that the differenced series has the same length and time base as the original series.

Seasonal difference

Has a seasonal, stochastic trend

You can specify the period in a season using the spin box. For example, `12` indicates a monthly seasonal transformation.

Econometric Modeler prepends the differenced series with `nan(period,1)`, where `period` is the specified period in a season. This action ensures that the differenced series has the same length and time base as the original series.

For more details, see Data Transformations.

To transform a variable, select the variable in the Data Browser, then click a transformation. After you transform a series, a new variable representing the transformed series appears in the Data Browser. Also, Econometric Modeler plots and selects the new variable. To create the variable name, the app appends the transformation name to the end of the variable name. You can rename the transformed variable by right-clicking it in the Data Browser, selecting Rename in the context menu, then entering the new name. You can select multiple series by pressing Ctrl and clicking each series, and then apply the same transformation to the selected series simultaneously. The app creates new variables for each series, appends the transformation name to the end of each transformed variable name, and plots the transformed variables in the same figure.

For example, suppose that the GDP series in `Data_USEconModel` has an exponential trend and a stochastic trend. Stabilize the GDP by applying the log transformation and then applying the second difference.

1. Import the `DataTable` variable in the `Data_USEconModel` data set into the Econometric Modeler (see Import Time Series Variables).

2. In the Data Browser, select `GDP`.

3. On the Econometric Modeler tab, in the Transforms section, click . The app creates a variable named `GDPLog`, which appears in the Data Browser, and displays a plot for the time series.

4. In the Transforms section, click . The app creates a variable named `GDPLogDiff` and displays a plot for the time series.

5. In the Transforms section, click . The app creates a variable called `GDPLogDiffDiff` and displays a plot for the time series.

`GDPLogDiffDiff` is the stabilized GDP.

### Fitting Models to Data

The results of an exploratory data analysis can suggest several candidate models. To choose a model, in the Data Browser, select a time series variable for the response, then, on the Econometric Modeler tab, in the Models section, click a model or click one in the models gallery. Econometric Modeler supports the following models.

ModelType
Conditional mean: ARMA/ARIMA Models section

Stationary autoregressive (AR)

For details, see Autoregressive Model, `arima`, and `estimate`.

Stationary moving average (MA)

For details, see Moving Average Model, `arima`, and `estimate`.

Stationary ARMA

For details, see Autoregressive Moving Average Model, `arima`, and `estimate`.

Nonstationary, integrated ARMA (ARIMA)

For details, see ARIMA Model, `arima`, and `estimate`.

Seasonal (Multiplicative) ARIMA (SARIMA)

For details, see Multiplicative ARIMA Model, `arima`, and `estimate`.

ARIMA including exogenous predictors (ARIMAX)

For details, see ARIMA Model Including Exogenous Covariates, `arima`, and `estimate`.

Seasonal ARIMAX

For details, see `arima` and `estimate`.

Conditional variance: GARCH Models section

Generalized autoregressive conditional heteroscedastic (GARCH)

For details, see GARCH Model, `garch`, and `estimate`.

Exponential GARCH (EGARCH)

For details, see EGARCH Model, `egarch`, and `estimate`.

Glosten, Jagannathan, and Runkle (GJR)

For details, see GJR Model, `gjr`, and `estimate`.

Multiple linear regression: Regression Models section

Multiple linear regression

For details, see Time Series Regression I: Linear Models, `LinearModel`, and `fitlm`.

Regression model with ARMA errors

For details, see Regression Models with Time Series Errors, `regARIMA`, and `estimate`.

For conditional mean model estimation, SARIMA and SARIMAX are the most flexible models. You can create any conditional mean model that excludes exogenous predictors by clicking , or you can create any conditional mean model that includes at least one exogenous predictor by clicking .

After you select a model, the app displays the `Type` Model Parameters dialog box, where `Type` is the model type. This figure shows the SARIMAX Model Parameters dialog box.

Adjustable parameters in the `Type` Model Parameters window depend on `Type`. In general, adjustable parameters include:

As you adjust parameter values, the equation in the Model Equation section changes to match your specifications. Adjustable parameters correspond to input and name-value pair arguments described in corresponding model creation reference pages. For details, see the function reference page for a specific model. Regardless of the model you choose, all coefficients in the model are unknown and estimable, including the t-distribution degrees of freedom parameter (when you specify a t innovation distribution).

### Note

Econometric Modeler does not support:

• Optimization option adjustments for estimation.

• Composite conditional mean and variance models. For details, see Specify Conditional Mean and Variance Models.

• Applying equality constraints to specified parameters during estimation (except for holding parameters fixed at zero during estimation).

To adjust optimization options, estimate composite conditional mean and variance models, or apply equality constraints, use the MATLAB command line.

#### Adjusting Model Constant and Regression Component Parameters

To include a model constant (offset or intercept) term, select the Include Constant Term or Include Offset Term check box. To remove the model constant (that is, constrain it to zero during estimation), clear the check box. The location and type of the check box in the `Type` Model Parameters dialog box depends on the model type. By default, Econometric Modeler includes a model constant in all model types except conditional variance models.

To select predictors for the regression component, in the Predictors list, select the check box in the Include? column corresponding to the predictors you want to include in the model. By default, the app does not include a regression component in any model type.

• If you select , , or , then you must choose at least one predictor.

• If you select , then you can specify one of the following:

• An MLR model when you choose at least one predictor

• A constant mean model (intercept-only model) when you clear all check boxes in the Include? column and select the Include Intercept check box

• An error-only model when you clear all check boxes in the Include? column and clear the Include Intercept check box

Consider a linear regression model of GDP onto CPI and the unemployment rate. To specify the regression:

1. Import the `DataTable` variable in the `Data_USEconModel` data set into the Econometric Modeler (see Import Time Series Variables).

2. In the Data Browser, select the response variable `GDP`.

3. On the Econometric Modeler tab, in the Models section, click the arrow to display the models gallery.

4. In the models gallery, in the Regression Models section, click .

5. In the MLR Model Parameters dialog box, in the Include? column, select the CPIAUCSL and UNRATE check boxes.

6. Click the button.

#### Adjusting Time Series Component Parameters

In general, time series component parameters contain lags to include in the seasonal and nonseasonal lag operator polynomials, and seasonal and nonseasonal degrees of integration.

• For conditional mean models, you can specify seasonal and nonseasonal autoregressive lags, and seasonal and nonseasonal moving average lags. You can also adjust seasonal and nonseasonal degrees of integration.

• For conditional variance models, you can specify ARCH and GARCH lags. EGARCH and GJR models also support leverage lags.

• For regression models with ARMA errors, you can specify nonseasonal autoregressive and moving average lags. For models containing seasonal lags or degrees of seasonal or nonseasonal integration, use the command line instead.

Econometric Modeler supports two options to adjust the parameters. The adjustment options are on separate tabs of the `Type` Model Parameters dialog box: the Lag Order and Lag Vector tabs. On the Lag Order tab, you can specify the orders of lag operator polynomials. This feature enables you to include all lags efficiently, from 1 through the specified order, in a lag operator polynomial. On the Lag Vector tab, you can specify the individual lags that comprise a lag operator polynomial. This feature is well suited for creating flexible models. For more details, see Specifying Lag Operator Polynomials Interactively.

For all models, you can specify that the distribution of the innovations is Gaussian. For all models, except multiple linear regression models, you can specify the Student's t instead to address leptokurtic innovation distributions (for more details, see Maximum Likelihood Estimation for Conditional Mean Models, Maximum Likelihood Estimation for Conditional Variance Models, or Maximum Likelihood Estimation of regARIMA Models). If you specify the t distribution, then Econometric Modeler estimates its degrees of freedom parameter using maximum likelihood.

By default, Econometric Modeler uses the Gaussian distribution for the innovations. To change the innovation distribution, in the `Type` Model Parameters dialog box, from the Innovation Distribution button, select a distribution in the list.

#### Estimating a Model

Econometric Modeler treats all parameters in the model as unknown and estimable. After you specify a model, fit it to the data by clicking in the `Type` Model Parameters dialog box.

### Note

After you estimate a model:

• A new variable that describes the estimated model appears in the Models section of the Data Browser with the name `Type_response`. `Type` is the model type and `response` is the response variable to which Econometric Modeler fit the model, for example, `ARIMA_FEDFUNDS`.

You operate on an estimated model in the Data Browser by right-clicking it. In addition to the options available for time series variables (see Import Time Series Variables), the context menu includes the `Modify` option, which enables you to modify and re-estimate a model. For example, right-click a model and select `Modify`. Then, in the `Type` Model Parameters dialog box, adjust parameters and click .

• The Model Summary(`Type_response`) document summarizing the estimation results appears in the right pane. Results shown depend on the model type. For conditional mean and regression models, results include:

• Model Fit — A time series plot of the response series and the fitted values $\stackrel{^}{y}$

• Parameters — An estimation summary table containing parameter estimates, standard errors, and t statistics and p-values for testing the null hypothesis that the corresponding parameter is 0

• Residual Plot — A time series plot of the residuals

• Goodness of Fit — Akaike information criterion (AIC) and Bayesian information criterion (BIC) model fit statistics

For conditional variance models, the results also include an estimation summary table and goodness-of-fit statistics, but Econometric Modeler plots:

• Conditional Variances — A time series plot of the inferred conditional variances ${\stackrel{^}{\sigma }}_{t}^{2}$

• Standardized Residuals — A time series plot of the standardized residuals $\frac{{y}_{t}-c}{{\stackrel{^}{\sigma }}_{t}^{2}}$, where c is the estimated offset

You can interact with individual plots by pausing on one and selecting an interaction (see Visualizing Time Series Data). You can also interact with the summary by right-clicking the document. Options include:

• Export — Place plot in a separate figure window.

• Show Model — Display the summary of another estimated model by pointing to Show Model, then selecting a model in the list.

• Show Recessions — Plot recession bands in time series plots.

Consider a SARIMA(0,1,1)×(0,1,1)12 for the monthly international airline passenger numbers from 1949 to 1960 in the `Data_Airline` data set. To estimate this model using the Econometric Modeler:

1. Import the `DataTable` variable in the `Data_Airline` data set into Econometric Modeler (see Import Time Series Variables).

2. On the Econometric Modeler tab, in the Models section, click the arrow > .

3. In the SARIMA Model Parameters dialog box, on the Lag Order tab:

• Nonseasonal section

1. Set Degrees of Integration to `1`.

2. Set Moving Average Order to `1`.

3. Clear the Include Constant Term check box.

• Seasonal section

1. Set Period to `12` to indicate monthly data.

2. Set Moving Average Order to `1`.

3. Select the Include Seasonal Difference check box.

4. Click .

A variable named `SARIMA_PSSG` appears in the Models section of the Data Browser, and this estimation summary appears in the new Model Summary(SARIMA_PSSG) document.

### Conducting Goodness-of-Fit Checks

After you estimate a model, a good practice is to determine the adequacy of the fitted model (see Goodness of Fit). Econometric Modeler is well suited for visually assessing the in-sample fit (for all models except conditional variance models) and performing residual diagnostics.

Residual diagnostics include evaluating the model assumptions and investigating whether you must respecify the model to address other properties of the data. Model assumptions to assess include checking whether the residuals are centered on zero, normally distributed, homoscedastic, and serially uncorrelated. If the residuals do not demonstrate all these properties, then you must determine the severity of the departure, whether to transform the data, and whether to specify a different model. For more details on residual diagnostics, see Time Series Regression VI: Residual Diagnostics and Residual Diagnostics.

To perform goodness-of-fit checks using Econometric Modeler, in the Models section of the Data Browser, select an estimated model. Then complete the following steps:

• To visually assess the in-sample fit for all models (except conditional variance models), inspect the Model Fit plot in the Model Summary document.

• To visually assess whether the residuals are centered on zero, autocorrelated, and heteroscedastic, inspect the Residual Plot in the Model Summary document.

• On the Econometric Modeler tab, in the Diagnostics section, click . The diagnostics gallery provides these residual plots and tests.

MethodDiagnostic

Residual histogram

Visually assess normality

Residual quantile-quantile plot

Visually assess normality and skewness

ACF

Visually assess whether residuals are autocorrelated

Ljung-Box Q-test

Test residuals for significant autocorrelation

ACF of squared residuals

Visually assess whether residuals have conditional heteroscedasticity

Engle's ARCH test

Test residuals for conditional heteroscedasticity (significant ARCH effects)

Alternatively, to plot a histogram, quantile-quantile plot, or ACF of the residuals of an estimated model:

1. Select a model in the Data Browser.

2. Click the Plots tab.

3. In the Plots section, click the arrow and then click one of the plots in the Model Plots section of the gallery.

### Note

Another important goodness-of-fit check is predictive-performance assessment. To assess the predictive performance of several models:

1. Fit a set of models to the data using Econometric Modeler.

2. Perform residual diagnostics on all models.

3. Choose a subset of models with desirable residual properties and minimal fit statistics (see Finding Model with Best In-Sample Fit).

4. Export the chosen models to the MATLAB Workspace (see Export Session Results).

5. Perform a predictive performance assessment at the command line (see Check Predictive Performance).

Consider performing goodness-of-fit checks on the estimated SARIMA(0,1,1)×(0,1,1)12 model for the airline counts data in Estimating a Model.

1. In the right pane, on the Model Summary(SARIMA_PSSG) document:

1. Model Fit suggests that the model fits to the data fairly well.

2. Residual Plot suggests that the residuals have a mean of zero. However, the residuals appear heteroscedastic and serially correlated.

2. On the Econometric Modeler tab, in the Diagnostics section, click . In the diagnostics gallery:

1. Click Residual Q-Q Plot. The right pane display a figure window named QQPlot(SARIMA_PSSG) containing a quantile-quantile plot of the residuals.

The plot suggests that the residuals are approximately normal, but with slightly heavier tails.

2. Click Autocorrelation Function. In the toolstrip, the ACF tab appears and contains plot options. The right pane displays a figure window named ACF(SARIMA_PSSG) containing the ACF of the residuals.

Because almost all the sample autocorrelation values are below the confidence bounds, the residuals are likely not serially correlated.

3. Click Engle's ARCH Test. On the ARCH tab, in the Tests section, click to run the test using default options. The right pane displays the ARCH(SARIMA_PSSG) document, which shows the test results in the Results table.

The results suggest rejection of the null hypothesis that the residuals exhibit no ARCH effects at a 5% level of significance. You can try removing heteroscedasticity by applying the log transformation to the series.

### Finding Model with Best In-Sample Fit

Econometric Modeler enables you to fit multiple related models to a data set efficiently. After you estimate a model, you can estimate other models by iterating the methods in Perform Exploratory Data Analysis, Fitting Models to Data, and Conducting Goodness-of-Fit Checks. After each iteration, a new model variable appears in the Models section of the Data Browser.

For models in the same parametric family that you fit to the same response series, you can determine the model with the best parsimonious, in-sample fit among the estimated models by comparing their fit statistics. From a subset of candidate models, to determine the model of best fit using Econometric Modeler:

1. In the Models section of the Data Browser, double-click an estimated model. In the right pane, estimation results of the model appear in the Model Summary(`Model`) document, where `Model` is the name of the selected model.

2. On the Model Summary(`Model`) document, in the Goodness of Fit table, choose a fit statistic (AIC or BIC) and record its value.

3. Iterate the previous steps for all candidate models.

4. Choose the model that yields the minimal fit statistic.

For more details on goodness-of-fit statistics, see Information Criteria.

Consider finding the best-fitting SARIMA model, with a period of 12, for the log of the airline passenger counts in the `Data_Airline` data set. Fit a subset of SARIMA models, considering all combinations of models that include up to two seasonal and nonseasonal MA lags.

1. Import the `DataTable` variable in the `Data_Airline` data set into Econometric Modeler (see Import Time Series Variables).

2. Apply the log transformation to `PSSG` (see Transforming Time Series).

3. Fit a SARIMA(0,1,q)×(0,1,q12)12 to `PSSGLog`, where all unknown orders are 0 (see Estimating a Model).

4. In the right pane, on the Model Summary(SARIMA_PSSGLog) document, in the Goodness of Fit table, record the AIC value.

5. In the Data Browser, select `PSSGLog`.

6. Iterate steps 4 and 5, but adjust q and q12 to cover the nine permutations of q ∈ {`0`,`1`,`2`} and q12 ∈ {`0`,`1`,`2`}. Econometric Modeler distinguishes subsequent models of the same type by appending consecutive digits to the end of the variable name.

The resulting AIC values are in this table.

ModelVariable NameAIC
SARIMA(0,1,0)×(0,1,0)12`SARIMA_PSSGLog1`-491.8042
SARIMA(0,1,0)×(0,1,1)12`SARIMA_PSSGLog2`-530.5327
SARIMA(0,1,0)×(0,1,2)12`SARIMA_PSSGLog3`-528.5330
SARIMA(0,1,1)×(0,1,0)12`SARIMA_PSSGLog4`-508.6853
SARIMA(0,1,1)×(0,1,1)12`SARIMA_PSSGLog5`-546.3970
SARIMA(0,1,1)×(0,1,2)12`SARIMA_PSSGLog6`-544.6444
SARIMA(0,1,2)×(0,1,0)12`SARIMA_PSSGLog7`-506.8027
SARIMA(0,1,2)×(0,1,1)12`SARIMA_PSSGLog8`-544.4789
SARIMA(0,1,2)×(0,1,2)12`SARIMA_PSSGLog9`-542.7171

Because it yields the minimal AIC, the SARIMA(0,1,1)×(0,1,1)12 model is the model with the best parsimonious, in-sample fit.

### Export Session Results

Econometric Modeler offers several options for you to share your session results. The option you choose depends on your analysis goals.

The options for sharing your results are in the Export section of the Econometric Modeler tab. This table describes the available options.

OptionDescription

Export Variables

Export time series and model variables to the MATLAB Workspace.

Choose this option to perform further analysis at the MATLAB command line. For example, you can generate forecasts from an estimated model or check the predictive performance of several models.

Generate Function

Generate a MATLAB function to use outside the app. The function accepts the data loaded into the app as input, and outputs a model estimated in the app session.

Choose this option to:

• Understand the functions used by Econometric Modeler to create and estimate the model.

• Modify the generated function in the MATLAB Editor for further use.

Generate Live Function

Generate a MATLAB live function to use outside the app. The function accepts the data loaded into the app as input, and outputs a model estimated in the app session.

Choose this option to:

• Understand the functions used by Econometric Modeler to create and estimate the model.

• Modify the generated function in the Live Editor for further use.

Generate Report

Generate a report that summarizes the session.

Choose this option when you achieve your analysis goals in Econometric Modeler, and you want to share a summary of the results.

#### Exporting Variables

To export time series and estimated model variables from the Data Browser to the MATLAB Workspace:

1. On the Econometric Modeler tab, in the Export section, click or > Export Variables.

2. In the Export Variables dialog box, all time series variables in the Data Browser appear in the left pane and all model variables appear in the right pane. Choose time series and model variables to export by selecting the corresponding check boxes in the Select column. The app selects the check box of all time series or model variables that are selected in the Data Browser. Clear any check boxes for variables to you do not want to export. For example, this figure shows how to select the `PSSGLog` time series and the `SARIMA_PSSGLog` SARIMA model.

3. Click Export.

The selected variables appear in the MATLAB Workspace. Time series variables are double-precision column vectors. Estimated models are objects of type depending on the model (for example, an exported ARIMA model is an `arima` object).

Alternatively, you can export variables from the Data Browser by selecting at least one variable, right-clicking a selected variable, and selecting Export.

#### Generating a Function

The app can generate a plain text function or a live function. The main difference between the two functions is the editor used to modify the generated function: you edit plain text functions in the MATLAB editor and live functions in the Live Editor. For more details on the differences between the two function types, see What Is a Live Script or Function? (MATLAB).

Regardless of the function type you choose, the generated function accepts the data loaded into the app as input, and outputs a model estimated in the app session. To export a MATLAB function or live function that creates a model estimated in an app session:

1. In the Data Browser, select an estimated model.

2. On the Econometric Modeler tab, in the Export section, click . In the Export menu, choose Generate Function or Generate Live Function.

The MATLAB Editor or Live Editor displays an untitled, unsaved function containing the code that estimates the model.

• By default, the function name is `modelTimeSeries`.

• The function accepts the originally imported data set as input.

• Before the function estimates the model, it extracts the variables from the input data set used in estimation, and applies the same transformations to the variables that you applied in Econometric Modeler.

• The function returns the selected estimated model.

Consider generating a live function that returns `SARIMA_PSSGLog`, the SARIMA(0,1,1)×(0,1,1)12 model fit to the log of airline passenger data (see Estimating a Model). This figure shows the generated live function.

#### Generating a Report

Econometric Modeler can produce a report describing your activities on selected time series and model variables. The app organizes the report into chapters corresponding to selected time series and model variables. Chapters describe session activities that you perform on the corresponding variable.

Chapters on time series variables describe transformations, plots, and tests that you perform on the selected variable in the session. Estimated model chapters contain an estimation summary, that is, elements of the Model Summary document (see Estimating a Model), and residual diagnostics plots and tests.

You can export the report as one of the following document types:

• Hypertext Markup Language (HTML)

• Microsoft® Word XML Format Document (DOCX)

• Portable Document Format (PDF)

To export a report:

1. On the Econometric Modeler tab, in the Export section, click > Generate Report.

2. In the Select items to include in report dialog box, all time series variables in the Data Browser appear in the left pane and all model variables appear in the right pane. Choose variables to include the report by selecting their check boxes in the Select column.

3. Select a document type by clicking Report Format and selecting the format you want.

4. Click .

5. In the Select File to Write window:

1. Browse to the folder in which you want to save the report.

2. In the File name box, type a name for the report.

3. Click .

Consider generating an HTML report for the analysis of the airline passenger data (see Conducting Goodness-of-Fit Checks). This figure shows how to select all variables and the HTML format.

This figure shows a sample of the generated report.

## References

[1] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.