{ "cells": [ { "cell_type": "markdown", "id": "66195396-2615-48ab-aa26-954532d0bc35", "metadata": {}, "source": [ "# SARIMAX and ARIMA: Frequently Asked Questions (FAQ)\n", "\n", "This notebook contains explanations for frequently asked questions.\n", "\n", "* Comparing trends and exogenous variables in `SARIMAX`, `ARIMA` and `AutoReg`\n", "* Reconstructing residuals, fitted values and forecasts in `SARIMAX` and `ARIMA`\n", "* Initial residuals in `SARIMAX` and `ARIMA`" ] }, { "cell_type": "markdown", "id": "174cebe5-2bfb-4258-96b0-a292e5cdbcf7", "metadata": {}, "source": [ "## Comparing trends and exogenous variables in `SARIMAX`, `ARIMA` and `AutoReg`\n", "\n", "`ARIMA` are formally OLS with ARMA errors. A basic AR(1) in the OLS with ARMA errors is described as \n", "\n", "$$\n", "\\begin{align}\n", "Y_t & = \\delta + \\epsilon_t \\\\\n", "\\epsilon_t & = \\rho \\epsilon_{t-1} + \\eta_t \\\\\n", "\\eta_t & \\sim WN(0,\\sigma^2) \\\\\n", "\\end{align}\n", "$$\n", "\n", "In large samples, $\\hat{\\delta}\\stackrel{p}{\\rightarrow} E[Y]$.\n", "\n", "`SARIMAX` uses a different representation, so that the model when estimated using `SARIMAX` is\n", "\n", "$$\n", "\\begin{align}\n", "Y_t & = \\phi + \\rho Y_{t-1} + \\eta_t \\\\\n", "\\eta_t & \\sim WN(0,\\sigma^2) \\\\\n", "\\end{align}\n", "$$\n", "\n", "\n", "This is the same representation that is used when the model is estimated using OLS (`AutoReg`). In large samples, $\\hat{\\phi}\\stackrel{p}{\\rightarrow} E[Y](1-\\rho)$.\n", "\n", "In the next cell, we simulate a large sample and verify that these relationship hold in practice." ] }, { "cell_type": "code", "execution_count": 1, "id": "ba21553a-e571-42ac-b166-b625a50509fe", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:10.694453Z", "iopub.status.busy": "2022-11-02T17:05:10.694168Z", "iopub.status.idle": "2022-11-02T17:05:11.344537Z", "shell.execute_reply": "2022-11-02T17:05:11.343888Z" } }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "id": "fe284c44-b750-4e6e-94d0-b238f364cd7b", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:11.349155Z", "iopub.status.busy": "2022-11-02T17:05:11.348668Z", "iopub.status.idle": "2022-11-02T17:05:11.627861Z", "shell.execute_reply": "2022-11-02T17:05:11.627215Z" } }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "rng = np.random.default_rng(20210819)\n", "eta = rng.standard_normal(5200)\n", "rho = 0.8\n", "beta = 10\n", "epsilon = eta.copy()\n", "for i in range(1, eta.shape[0]):\n", " epsilon[i] = rho * epsilon[i - 1] + eta[i]\n", "y = beta + epsilon\n", "y = y[200:]" ] }, { "cell_type": "code", "execution_count": 3, "id": "f02b87c6-ee8f-4bb1-bf08-d252b9277733", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:11.633236Z", "iopub.status.busy": "2022-11-02T17:05:11.632051Z", "iopub.status.idle": "2022-11-02T17:05:12.114839Z", "shell.execute_reply": "2022-11-02T17:05:12.114132Z" } }, "outputs": [], "source": [ "from statsmodels.tsa.api import SARIMAX, AutoReg\n", "from statsmodels.tsa.arima.model import ARIMA" ] }, { "cell_type": "markdown", "id": "6e8212dc-e259-422f-b10b-3b742e86b36c", "metadata": {}, "source": [ "The three models are specified and estimated in the next cell. An AR(0) is included as a reference. The AR(0) is identical using all three estimators." ] }, { "cell_type": "code", "execution_count": 4, "id": "7200d248-bd47-4c95-9f1c-6daaf1e09bb1", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:12.121690Z", "iopub.status.busy": "2022-11-02T17:05:12.119881Z", "iopub.status.idle": "2022-11-02T17:05:12.998575Z", "shell.execute_reply": "2022-11-02T17:05:12.997804Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " This problem is unconstrained.\n", " This problem is unconstrained.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "RUNNING THE L-BFGS-B CODE\n", "\n", " * * *\n", "\n", "Machine precision = 2.220D-16\n", " N = 2 M = 10\n", "\n", "At X0 0 variables are exactly at the bounds\n", "\n", "At iterate 0 f= 1.91760D+00 |proj g|= 3.68860D-06\n", "\n", " * * *\n", "\n", "Tit = total number of iterations\n", "Tnf = total number of function evaluations\n", "Tnint = total number of segments explored during Cauchy searches\n", "Skip = number of BFGS updates skipped\n", "Nact = number of active bounds at final generalized Cauchy point\n", "Projg = norm of the final projected gradient\n", "F = final function value\n", "\n", " * * *\n", "\n", " N Tit Tnf Tnint Skip Nact Projg F\n", " 2 0 1 0 0 0 3.689D-06 1.918D+00\n", " F = 1.9175996129577773 \n", "\n", "CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL \n", "RUNNING THE L-BFGS-B CODE\n", "\n", " * * *\n", "\n", "Machine precision = 2.220D-16\n", " N = 3 M = 10\n", "\n", "At X0 0 variables are exactly at the bounds\n", "\n", "At iterate 0 f= 1.41373D+00 |proj g|= 9.51828D-04\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", " * * *\n", "\n", "Tit = total number of iterations\n", "Tnf = total number of function evaluations\n", "Tnint = total number of segments explored during Cauchy searches\n", "Skip = number of BFGS updates skipped\n", "Nact = number of active bounds at final generalized Cauchy point\n", "Projg = norm of the final projected gradient\n", "F = final function value\n", "\n", " * * *\n", "\n", " N Tit Tnf Tnint Skip Nact Projg F\n", " 3 2 5 1 0 0 4.516D-05 1.414D+00\n", " F = 1.4137311050015484 \n", "\n", "CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH \n" ] } ], "source": [ "ar0_res = SARIMAX(y, order=(0, 0, 0), trend=\"c\").fit()\n", "sarimax_res = SARIMAX(y, order=(1, 0, 0), trend=\"c\").fit()\n", "arima_res = ARIMA(y, order=(1, 0, 0), trend=\"c\").fit()\n", "autoreg_res = AutoReg(y, 1, trend=\"c\").fit()" ] }, { "cell_type": "markdown", "id": "3f502bdd-9ba5-47e4-8aeb-e83e5e1d8898", "metadata": {}, "source": [ "The table below contains the estimated parameter in the model, the estimated AR(1) coefficient, and the long-run mean which is either equal to the estimated parameters (AR(0) or `ARIMA`), or depends on the ratio of the intercept to 1 minus the AR(1) parameter." ] }, { "cell_type": "code", "execution_count": 5, "id": "8ff07d0e-6754-4664-93e4-0f9299096868", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:13.002667Z", "iopub.status.busy": "2022-11-02T17:05:13.002242Z", "iopub.status.idle": "2022-11-02T17:05:13.032073Z", "shell.execute_reply": "2022-11-02T17:05:13.031125Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
AR(0)SARIMAXARIMAAutoReg
delta-or-phi9.77451.9857149.7744981.985790
rho0.00000.7968460.7968750.796882
long-run mean9.77459.7744249.7744989.776537
\n", "
" ], "text/plain": [ " AR(0) SARIMAX ARIMA AutoReg\n", "delta-or-phi 9.7745 1.985714 9.774498 1.985790\n", "rho 0.0000 0.796846 0.796875 0.796882\n", "long-run mean 9.7745 9.774424 9.774498 9.776537" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "intercept = [\n", " ar0_res.params[0],\n", " sarimax_res.params[0],\n", " arima_res.params[0],\n", " autoreg_res.params[0],\n", "]\n", "rho_hat = [0] + [r.params[1] for r in (sarimax_res, arima_res, autoreg_res)]\n", "long_run = [\n", " ar0_res.params[0],\n", " sarimax_res.params[0] / (1 - sarimax_res.params[1]),\n", " arima_res.params[0],\n", " autoreg_res.params[0] / (1 - autoreg_res.params[1]),\n", "]\n", "cols = [\"AR(0)\", \"SARIMAX\", \"ARIMA\", \"AutoReg\"]\n", "pd.DataFrame(\n", " [intercept, rho_hat, long_run],\n", " columns=cols,\n", " index=[\"delta-or-phi\", \"rho\", \"long-run mean\"],\n", ")" ] }, { "cell_type": "markdown", "id": "4f81803a-0902-4715-a1a6-0a609c8bd614", "metadata": {}, "source": [ "### Differences between trend and exog in `SARIMAX`\n", "\n", "When `SARIMAX` includes `exog` variables, then the `exog` are treated as OLS regressors, so that the model estimated is\n", "\n", "$$\n", "\\begin{align}\n", "Y_t - X_t \\beta & = \\delta + \\rho (Y_{t-1} - X_{t-1}\\beta) + \\eta_t \\\\\n", "\\eta_t & \\sim WN(0,\\sigma^2) \\\\\n", "\\end{align}\n", "$$\n", "\n", "In the next example, we omit the trend and instead include a column of 1, which produces a model that is equivalent, in large samples, to the case with no exogenous regressor and `trend=\"c\"`. Here the estimated value of `const` matches the value estimated using `ARIMA`. This happens since both exog in `SARIMAX` and the trend in `ARIMA` are treated as linear regression models with ARMA errors." ] }, { "cell_type": "code", "execution_count": 6, "id": "c18adf81-1ad9-4d11-a23b-e6d139c1fa3e", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:13.036484Z", "iopub.status.busy": "2022-11-02T17:05:13.035792Z", "iopub.status.idle": "2022-11-02T17:05:13.474979Z", "shell.execute_reply": "2022-11-02T17:05:13.474105Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "RUNNING THE L-BFGS-B CODE\n", "\n", " * * *\n", "\n", "Machine precision = 2.220D-16\n", " N = 3 M = 10\n", "\n", "At X0 0 variables are exactly at the bounds\n", "\n", "At iterate 0 f= 1.41373D+00 |proj g|= 1.06920D-04\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ " This problem is unconstrained.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", " * * *\n", "\n", "Tit = total number of iterations\n", "Tnf = total number of function evaluations\n", "Tnint = total number of segments explored during Cauchy searches\n", "Skip = number of BFGS updates skipped\n", "Nact = number of active bounds at final generalized Cauchy point\n", "Projg = norm of the final projected gradient\n", "F = final function value\n", "\n", " * * *\n", "\n", " N Tit Tnf Tnint Skip Nact Projg F\n", " 3 1 4 1 0 0 4.752D-05 1.414D+00\n", " F = 1.4137311099487531 \n", "\n", "CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH \n", " SARIMAX Results \n", "==============================================================================\n", "Dep. Variable: y No. Observations: 5000\n", "Model: SARIMAX(1, 0, 0) Log Likelihood -7068.656\n", "Date: Wed, 02 Nov 2022 AIC 14143.311\n", "Time: 17:05:13 BIC 14162.863\n", "Sample: 0 HQIC 14150.164\n", " - 5000 \n", "Covariance Type: opg \n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", "------------------------------------------------------------------------------\n", "const 9.7745 0.069 141.177 0.000 9.639 9.910\n", "ar.L1 0.7969 0.009 93.691 0.000 0.780 0.814\n", "sigma2 0.9894 0.020 49.921 0.000 0.951 1.028\n", "===================================================================================\n", "Ljung-Box (L1) (Q): 0.42 Jarque-Bera (JB): 0.08\n", "Prob(Q): 0.51 Prob(JB): 0.96\n", "Heteroskedasticity (H): 0.97 Skew: -0.01\n", "Prob(H) (two-sided): 0.47 Kurtosis: 2.99\n", "===================================================================================\n", "\n", "Warnings:\n", "[1] Covariance matrix calculated using the outer product of gradients (complex-step).\n" ] } ], "source": [ "sarimax_exog_res = SARIMAX(y, exog=np.ones_like(y), order=(1, 0, 0), trend=\"n\").fit()\n", "print(sarimax_exog_res.summary())" ] }, { "cell_type": "markdown", "id": "74d8b733-e74f-4e86-b663-111ab6953b79", "metadata": {}, "source": [ "### Using `exog` in `SARIMAX` and `ARIMA`\n", "\n", "While `exog` are treated the same in both models, the intercept continues to differ. Below we add an exogenous regressor to `y` and then fit the model using all three methods. The data generating process is now\n", "\n", "$$\n", "\\begin{align}\n", "Y_t & = \\delta + X_t \\beta + \\epsilon_t \\\\\n", "\\epsilon_t & = \\rho \\epsilon_{t-1} + \\eta_t \\\\\n", "\\eta_t & \\sim WN(0,\\sigma^2) \\\\\n", "\\end{align}\n", "$$\n" ] }, { "cell_type": "code", "execution_count": 7, "id": "8978b4c9-05cb-4674-9c67-53eccd8302a0", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:13.481947Z", "iopub.status.busy": "2022-11-02T17:05:13.481351Z", "iopub.status.idle": "2022-11-02T17:05:13.486499Z", "shell.execute_reply": "2022-11-02T17:05:13.485947Z" } }, "outputs": [], "source": [ "full_x = rng.standard_normal(eta.shape)\n", "x = full_x[200:]\n", "y += 3 * x" ] }, { "cell_type": "code", "execution_count": 8, "id": "8bebdfd6-cb1b-4c33-a4a5-3eb54fe73e24", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:13.490849Z", "iopub.status.busy": "2022-11-02T17:05:13.489740Z", "iopub.status.idle": "2022-11-02T17:05:15.480730Z", "shell.execute_reply": "2022-11-02T17:05:15.480030Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "RUNNING THE L-BFGS-B CODE\n", "\n", " * * *\n", "\n", "Machine precision = 2.220D-16\n", " N = 4 M = 10\n", "\n", "At X0 0 variables are exactly at the bounds\n", "\n", "At iterate 0 f= 1.42683D+00 |proj g|= 2.05943D-01\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ " This problem is unconstrained.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "At iterate 5 f= 1.41332D+00 |proj g|= 1.60874D-03\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "At iterate 10 f= 1.41329D+00 |proj g|= 3.11658D-05\n", "\n", " * * *\n", "\n", "Tit = total number of iterations\n", "Tnf = total number of function evaluations\n", "Tnint = total number of segments explored during Cauchy searches\n", "Skip = number of BFGS updates skipped\n", "Nact = number of active bounds at final generalized Cauchy point\n", "Projg = norm of the final projected gradient\n", "F = final function value\n", "\n", " * * *\n", "\n", " N Tit Tnf Tnint Skip Nact Projg F\n", " 4 11 15 1 0 0 1.796D-06 1.413D+00\n", " F = 1.4132928400115972 \n", "\n", "CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL \n" ] } ], "source": [ "sarimax_exog_res = SARIMAX(y, exog=x, order=(1, 0, 0), trend=\"c\").fit()\n", "arima_exog_res = ARIMA(y, exog=x, order=(1, 0, 0), trend=\"c\").fit()" ] }, { "cell_type": "markdown", "id": "9015313a-a7b1-436c-a0f0-c567aae09141", "metadata": {}, "source": [ "Examining the parameter tables, we see that the parameter estimates on `x1` are identical while the estimates of the `intercept` continue to differ due to the differences in the treatment of trends in these estimators." ] }, { "cell_type": "markdown", "id": "34f02944-22c0-47d6-8f53-2f3528a99e1a", "metadata": {}, "source": [ "#### `SARIMAX`" ] }, { "cell_type": "code", "execution_count": 9, "id": "573ef935-85d2-49e6-b6a1-0041253fc71a", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:15.487561Z", "iopub.status.busy": "2022-11-02T17:05:15.485819Z", "iopub.status.idle": "2022-11-02T17:05:15.528104Z", "shell.execute_reply": "2022-11-02T17:05:15.527556Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
intercept1.98490.08523.4840.01.8192.151
x13.02310.011277.1500.03.0023.044
ar.L10.79690.00993.7350.00.7800.814
sigma20.98860.02049.9410.00.9501.027
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "intercept 1.9849 0.085 23.484 0.0 1.819 2.151\n", "x1 3.0231 0.011 277.150 0.0 3.002 3.044\n", "ar.L1 0.7969 0.009 93.735 0.0 0.780 0.814\n", "sigma2 0.9886 0.020 49.941 0.0 0.950 1.027" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def print_params(s):\n", " from io import StringIO\n", "\n", " return pd.read_csv(StringIO(s.tables[1].as_csv()), index_col=0)\n", "\n", "\n", "print_params(sarimax_exog_res.summary())" ] }, { "cell_type": "markdown", "id": "fb72481a-29db-4e40-bdc4-8023ff81c51a", "metadata": {}, "source": [ "#### `ARIMA`" ] }, { "cell_type": "code", "execution_count": 10, "id": "101e7417-d6fc-448c-9d87-9ba44aafcc70", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:15.532292Z", "iopub.status.busy": "2022-11-02T17:05:15.531147Z", "iopub.status.idle": "2022-11-02T17:05:15.568496Z", "shell.execute_reply": "2022-11-02T17:05:15.567918Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
const9.77410.069141.2010.09.6389.910
x13.02310.011277.1400.03.0023.044
ar.L10.79690.00993.7280.00.7800.814
sigma20.98860.02049.9410.00.9501.027
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "const 9.7741 0.069 141.201 0.0 9.638 9.910\n", "x1 3.0231 0.011 277.140 0.0 3.002 3.044\n", "ar.L1 0.7969 0.009 93.728 0.0 0.780 0.814\n", "sigma2 0.9886 0.020 49.941 0.0 0.950 1.027" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print_params(arima_exog_res.summary())" ] }, { "cell_type": "markdown", "id": "553c24db-4156-4867-b711-f0e1369c9382", "metadata": {}, "source": [ "### `exog` in `AutoReg`\n", "\n", "When using `AutoReg` to estimate a model using OLS, the model differs from both `SARIMAX` and `ARIMA`. The `AutoReg` specification with exogenous variables is \n", "\n", "$$\n", "\\begin{align}\n", "Y_t & = \\phi + \\rho Y_{t-1} + X_{t}\\beta + \\eta_t \\\\\n", "\\eta_t & \\sim WN(0,\\sigma^2) \\\\\n", "\\end{align}\n", "$$\n", "\n", "This specification is not equivalent to the specification estimated in `SARIMAX` and `ARIMA`. Here the difference is non-trivial, and naive estimation on the same time series results in different parameter values, even in large samples (and the limit). Estimating this model changes the parameter estimates on the AR(1) coefficient." ] }, { "cell_type": "markdown", "id": "4259b7e0-3624-4724-bdbf-eba073a5efb6", "metadata": {}, "source": [ "#### `AutoReg`" ] }, { "cell_type": "code", "execution_count": 11, "id": "3af7fcc8-6e85-4d76-b2c8-e57a782c0884", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:15.574185Z", "iopub.status.busy": "2022-11-02T17:05:15.572627Z", "iopub.status.idle": "2022-11-02T17:05:15.609546Z", "shell.execute_reply": "2022-11-02T17:05:15.608990Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
const7.97140.064124.5250.07.8468.097
y.L10.18380.00629.8900.00.1720.196
x13.03110.021142.5130.02.9893.073
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "const 7.9714 0.064 124.525 0.0 7.846 8.097\n", "y.L1 0.1838 0.006 29.890 0.0 0.172 0.196\n", "x1 3.0311 0.021 142.513 0.0 2.989 3.073" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "autoreg_exog_res = AutoReg(y, 1, exog=x, trend=\"c\").fit()\n", "print_params(autoreg_exog_res.summary())" ] }, { "cell_type": "markdown", "id": "170b7189-8efc-4b7e-9243-46e5ee6043cb", "metadata": {}, "source": [ "The key difference can be seen by writing the model in lag operator notation.\n", "\n", "$$\n", "\\begin{align}\n", "(1-\\phi L ) Y_t & = X_{t}\\beta + \\eta_t \\Rightarrow \\\\\n", "Y_t & = (1-\\phi L )^{-1}\\left(X_{t}\\beta + \\eta_t\\right) \\\\\n", "Y_t & = \\sum_{i=0}^{\\infty} \\phi^i \\left(X_{t-i}\\beta + \\eta_{t-i}\\right)\n", "\\end{align}\n", "$$\n", "\n", "where it is is assumed that $|\\phi|<1$. Here we see that $Y_t$ depends on all lagged values of $X_t$ and $\\eta_t$. This differs from the specification estimated by `SARIMAX` and `ARIMA`, which can be seen to be\n", "\n", "$$\n", "\\begin{align}\n", "Y_t - X_t \\beta & = \\delta + \\rho (Y_{t-1} - X_{t-1}\\beta) + \\eta_t \\\\\n", "\\left(1-\\rho L \\right)\\left(Y_t - X_t \\beta\\right) & = \\delta + \\eta_t \\\\\n", "Y_t - X_t \\beta & = \\frac{\\delta}{1-\\rho} + \\left(1-\\rho L \\right)^{-1}\\eta_t \\\\\n", "Y_t - X_t \\beta & = \\frac{\\delta}{1-\\rho} + \\sum_{i=0}^\\infty \\rho^i \\eta_{t-i} \\\\\n", "Y_t & = \\frac{\\delta}{1-\\rho} + X_t \\beta + \\sum_{i=0}^\\infty \\rho^i \\eta_{t-i} \\\\\n", "\\end{align}\n", "$$\n", "\n", "In this specification, $Y_t$ only depends on $X_t$ and no other lags." ] }, { "cell_type": "markdown", "id": "869a050c-ea1b-42df-aac3-a14722c109e9", "metadata": {}, "source": [ "### Using the correct DGP with `AutoReg`\n", "\n", "Simulating the process that is estimated in `AutoReg` shows that the parameters are recovered from the true model. " ] }, { "cell_type": "code", "execution_count": 12, "id": "faa9c3a2-aa68-4a9c-ade2-edf4df7798c3", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:15.615149Z", "iopub.status.busy": "2022-11-02T17:05:15.613569Z", "iopub.status.idle": "2022-11-02T17:05:15.631153Z", "shell.execute_reply": "2022-11-02T17:05:15.630626Z" } }, "outputs": [], "source": [ "y = beta + eta\n", "epsilon = eta.copy()\n", "for i in range(1, eta.shape[0]):\n", " y[i] = beta * (1 - rho) + rho * y[i - 1] + 3 * full_x[i] + eta[i]\n", "y = y[200:]" ] }, { "cell_type": "markdown", "id": "5c37ad9d-dad8-4a51-adba-88b60667698c", "metadata": {}, "source": [ "#### `AutoReg` with correct DGP" ] }, { "cell_type": "code", "execution_count": 13, "id": "2734e0db-39ab-4233-90b2-7c60ba48483a", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:15.637061Z", "iopub.status.busy": "2022-11-02T17:05:15.635518Z", "iopub.status.idle": "2022-11-02T17:05:15.671265Z", "shell.execute_reply": "2022-11-02T17:05:15.670719Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
const1.98700.03066.5260.01.9282.046
y.L10.79680.003300.3820.00.7920.802
x13.02630.014217.0340.02.9993.054
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "const 1.9870 0.030 66.526 0.0 1.928 2.046\n", "y.L1 0.7968 0.003 300.382 0.0 0.792 0.802\n", "x1 3.0263 0.014 217.034 0.0 2.999 3.054" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "autoreg_alt_exog_res = AutoReg(y, 1, exog=x, trend=\"c\").fit()\n", "print_params(autoreg_alt_exog_res.summary())" ] }, { "cell_type": "markdown", "id": "3a51863e-6799-402b-96a2-b1212ea86216", "metadata": {}, "source": [ "## Reconstructing residuals, fitted values and forecasts in `SARIMAX` and `ARIMA`\n", "\n", "In models that contain only autoregressive terms, trends and exogenous variables, fitted values and forecasts can be easily reconstructed once the maximum lag length in the model has been reached. In practice, this means after $(P+D)s+p+d$ periods. Earlier predictions and residuals are harder to reconstruct since the model builds the best prediction for $Y_t|Y_{t-1},Y_{t-2},...$. When the number of lags of $Y$ is less than the autoregressive order, then the expression for the optimal prediction differs from the model. For example, when predicting the very first value, $Y_1$, there is no information available from the history of $Y$, and so the best prediction is the unconditional mean. In the case of an AR(1), the second prediction will follow the model, so that when using `ARIMA`, the prediction is\n", "\n", "$$\n", "Y_2 = \\hat{\\delta} + \\hat{\\rho} \\left(Y_1 - \\hat{\\delta}\\right)\n", "$$\n", "\n", "since `ARIMA` treats both exogenous and trend terms as regression with ARMA errors.\n", "\n", "This can be seen in the next set of cells." ] }, { "cell_type": "code", "execution_count": 14, "id": "0c17c510-0e76-41a2-a6a0-4ac9fa705136", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:15.674754Z", "iopub.status.busy": "2022-11-02T17:05:15.674348Z", "iopub.status.idle": "2022-11-02T17:05:16.196418Z", "shell.execute_reply": "2022-11-02T17:05:16.195711Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
const9.93460.22244.6670.09.49910.371
ar.L10.79570.00992.5150.00.7790.813
sigma210.30150.20450.4960.09.90210.701
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "const 9.9346 0.222 44.667 0.0 9.499 10.371\n", "ar.L1 0.7957 0.009 92.515 0.0 0.779 0.813\n", "sigma2 10.3015 0.204 50.496 0.0 9.902 10.701" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "arima_res = ARIMA(y, order=(1, 0, 0), trend=\"c\").fit()\n", "print_params(arima_res.summary())" ] }, { "cell_type": "code", "execution_count": 15, "id": "7198b7b8-e564-4284-8d68-7b4b7a3fd914", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:16.200844Z", "iopub.status.busy": "2022-11-02T17:05:16.200539Z", "iopub.status.idle": "2022-11-02T17:05:16.210192Z", "shell.execute_reply": "2022-11-02T17:05:16.209538Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 9.93458658, 10.91088035, 11.80415747])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "arima_res.predict(0, 2)" ] }, { "cell_type": "code", "execution_count": 16, "id": "d887b51b-f689-4dd1-874c-5bc95010bdd8", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:16.214113Z", "iopub.status.busy": "2022-11-02T17:05:16.213815Z", "iopub.status.idle": "2022-11-02T17:05:16.220207Z", "shell.execute_reply": "2022-11-02T17:05:16.219689Z" } }, "outputs": [ { "data": { "text/plain": [ "10.910880346330751" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "delta_hat, rho_hat = arima_res.params[:2]\n", "delta_hat + rho_hat * (y[0] - delta_hat)" ] }, { "cell_type": "markdown", "id": "646b941f-5f5b-40c4-be15-a7a1f54af5af", "metadata": {}, "source": [ "`SARIMAX` treats trend terms differently, and so the one-step forecast from a model estimated using `SARIMAX` is\n", "\n", "$$\n", "Y_2 = \\hat\\delta + \\hat\\rho Y_1\n", "$$" ] }, { "cell_type": "code", "execution_count": 17, "id": "76e37005-93f3-4b5b-8a63-de67f7f1f8a6", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:16.223200Z", "iopub.status.busy": "2022-11-02T17:05:16.222794Z", "iopub.status.idle": "2022-11-02T17:05:16.606740Z", "shell.execute_reply": "2022-11-02T17:05:16.605717Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " This problem is unconstrained.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "RUNNING THE L-BFGS-B CODE\n", "\n", " * * *\n", "\n", "Machine precision = 2.220D-16\n", " N = 3 M = 10\n", "\n", "At X0 0 variables are exactly at the bounds\n", "\n", "At iterate 0 f= 2.58518D+00 |proj g|= 5.99456D-05\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", " * * *\n", "\n", "Tit = total number of iterations\n", "Tnf = total number of function evaluations\n", "Tnint = total number of segments explored during Cauchy searches\n", "Skip = number of BFGS updates skipped\n", "Nact = number of active bounds at final generalized Cauchy point\n", "Projg = norm of the final projected gradient\n", "F = final function value\n", "\n", " * * *\n", "\n", " N Tit Tnf Tnint Skip Nact Projg F\n", " 3 3 5 1 0 0 3.347D-05 2.585D+00\n", " F = 2.5851830060985752 \n", "\n", "CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH \n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
intercept2.02830.09720.8410.01.8382.219
ar.L10.79590.00992.5360.00.7790.813
sigma210.30070.20450.5000.09.90110.700
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "intercept 2.0283 0.097 20.841 0.0 1.838 2.219\n", "ar.L1 0.7959 0.009 92.536 0.0 0.779 0.813\n", "sigma2 10.3007 0.204 50.500 0.0 9.901 10.700" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sarima_res = SARIMAX(y, order=(1, 0, 0), trend=\"c\").fit()\n", "print_params(sarima_res.summary())" ] }, { "cell_type": "code", "execution_count": 18, "id": "35546219-1730-41ed-be61-06e8fc7487b2", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:16.610255Z", "iopub.status.busy": "2022-11-02T17:05:16.609989Z", "iopub.status.idle": "2022-11-02T17:05:16.615810Z", "shell.execute_reply": "2022-11-02T17:05:16.615119Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 9.93588659, 10.91128867, 11.80469658])" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sarima_res.predict(0, 2)" ] }, { "cell_type": "code", "execution_count": 19, "id": "52620a07-ab3c-4a9c-b1b2-b6976ed335bc", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:16.618776Z", "iopub.status.busy": "2022-11-02T17:05:16.618548Z", "iopub.status.idle": "2022-11-02T17:05:16.624132Z", "shell.execute_reply": "2022-11-02T17:05:16.623153Z" } }, "outputs": [ { "data": { "text/plain": [ "10.911288670367867" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "delta_hat, rho_hat = sarima_res.params[:2]\n", "delta_hat + rho_hat * y[0]" ] }, { "cell_type": "markdown", "id": "71873544-677a-4061-87ed-76c095cc37f0", "metadata": {}, "source": [ "### Prediction with MA components\n", "\n", "When a model contains a MA component, the prediction is more complicated since errors are never directly observable. The prediction is still $Y_t|Y_{t-1},Y_{t-2},...$, and when the MA component is invertible, then the optimal prediction can be represented as a $t$-lag AR process. When $t$ is large, this should be very close to the prediction as if the errors were observable. For short lags, this can differ markedly.\n", "\n", "In the next cell we simulate an MA(1) process, and fit an MA model." ] }, { "cell_type": "code", "execution_count": 20, "id": "c4db1fb2-135e-43cf-a55f-852698ca9540", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:16.627246Z", "iopub.status.busy": "2022-11-02T17:05:16.627021Z", "iopub.status.idle": "2022-11-02T17:05:17.440341Z", "shell.execute_reply": "2022-11-02T17:05:17.439710Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
coefstd errzP>|z|[0.0250.975]
const9.91850.025391.1290.09.8699.968
ma.L10.80250.00993.8640.00.7860.819
sigma20.99040.02049.9250.00.9511.029
\n", "
" ], "text/plain": [ " coef std err z P>|z| [0.025 0.975] \n", " \n", "const 9.9185 0.025 391.129 0.0 9.869 9.968\n", "ma.L1 0.8025 0.009 93.864 0.0 0.786 0.819\n", "sigma2 0.9904 0.020 49.925 0.0 0.951 1.029" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rho = 0.8\n", "beta = 10\n", "epsilon = eta.copy()\n", "for i in range(1, eta.shape[0]):\n", " epsilon[i] = rho * eta[i - 1] + eta[i]\n", "y = beta + epsilon\n", "y = y[200:]\n", "\n", "ma_res = ARIMA(y, order=(0, 0, 1), trend=\"c\").fit()\n", "print_params(ma_res.summary())" ] }, { "cell_type": "markdown", "id": "21826604-ee43-47c1-82e5-cd2b6728a36c", "metadata": {}, "source": [ "We start by looking at predictions near the beginning of the sample corresponding `y[1]`, ..., `y[5]`." ] }, { "cell_type": "code", "execution_count": 21, "id": "ed868e49-e12e-44fd-bf09-37b1b33cf3f9", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.443934Z", "iopub.status.busy": "2022-11-02T17:05:17.443517Z", "iopub.status.idle": "2022-11-02T17:05:17.450555Z", "shell.execute_reply": "2022-11-02T17:05:17.449991Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 8.57011015, 9.19907188, 8.96971353, 9.78987115, 11.11984478])" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ma_res.predict(1, 5)" ] }, { "cell_type": "markdown", "id": "6e2c410e-c03f-45bd-957d-272f71dd49e7", "metadata": {}, "source": [ "and the corresponding residuals that are needed to produce the \"direct\" forecasts" ] }, { "cell_type": "code", "execution_count": 22, "id": "8356c92c-6686-41e0-93fc-3f5c0983fd89", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.453484Z", "iopub.status.busy": "2022-11-02T17:05:17.453123Z", "iopub.status.idle": "2022-11-02T17:05:17.458634Z", "shell.execute_reply": "2022-11-02T17:05:17.458083Z" } }, "outputs": [ { "data": { "text/plain": [ "array([-2.7621904 , -1.12255005, -1.33557621, -0.17206944, 1.5634041 ])" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ma_res.resid[:5]" ] }, { "cell_type": "markdown", "id": "9092d6a2-2de2-46f2-9965-6ecc471d7661", "metadata": {}, "source": [ "Using the model parameters, we can produce the \"direct\" forecasts using the MA(1) specification\n", "\n", "$$\n", "\\hat Y_t = \\hat\\delta + \\hat\\rho \\hat\\epsilon_{t-1}\n", "$$\n", "\n", "We see that these are not especially close to the actual model predictions for the initial forecasts, but that the gap quickly reduces." ] }, { "cell_type": "code", "execution_count": 23, "id": "ea2373ad-533f-44b9-9597-7a34a1eeb4be", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.461448Z", "iopub.status.busy": "2022-11-02T17:05:17.461088Z", "iopub.status.idle": "2022-11-02T17:05:17.466561Z", "shell.execute_reply": "2022-11-02T17:05:17.466016Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 7.70168405, 9.01756049, 8.84659855, 9.7803589 , 11.17314527])" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "delta_hat, rho_hat = ma_res.params[:2]\n", "direct = delta_hat + rho_hat * ma_res.resid[:5]\n", "direct" ] }, { "cell_type": "markdown", "id": "eab3797d-d51e-41af-b452-6a64deb9bc9c", "metadata": {}, "source": [ "The difference is nearly a standard deviation for the first but declines as the index increases." ] }, { "cell_type": "code", "execution_count": 24, "id": "e469678d-2791-4344-ac0d-00e0937db050", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.469374Z", "iopub.status.busy": "2022-11-02T17:05:17.469016Z", "iopub.status.idle": "2022-11-02T17:05:17.477154Z", "shell.execute_reply": "2022-11-02T17:05:17.476594Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 0.8684261 , 0.18151139, 0.12311499, 0.00951225, -0.05330049])" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ma_res.predict(1, 5) - direct" ] }, { "cell_type": "markdown", "id": "b45bf944-392a-432f-a89a-4d0d9c19f30d", "metadata": {}, "source": [ "We next look at the end of the sample and the final three predictions." ] }, { "cell_type": "code", "execution_count": 25, "id": "c5e38740-78fb-450c-a20a-2ce04f7bff9e", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.481101Z", "iopub.status.busy": "2022-11-02T17:05:17.480736Z", "iopub.status.idle": "2022-11-02T17:05:17.489172Z", "shell.execute_reply": "2022-11-02T17:05:17.488622Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 9.79692804, 10.51272714, 10.55855562])" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t = y.shape[0]\n", "ma_res.predict(t - 3, t - 1)" ] }, { "cell_type": "code", "execution_count": 26, "id": "77418292-c7f0-4a0a-9ef0-050d4350aa51", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.493271Z", "iopub.status.busy": "2022-11-02T17:05:17.492467Z", "iopub.status.idle": "2022-11-02T17:05:17.501701Z", "shell.execute_reply": "2022-11-02T17:05:17.501146Z" } }, "outputs": [ { "data": { "text/plain": [ "array([-0.15142355, 0.74049384, 0.79759816])" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ma_res.resid[-4:-1]" ] }, { "cell_type": "code", "execution_count": 27, "id": "e8d6e6ed-9575-46ed-a8f0-02e376ee3db9", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.505401Z", "iopub.status.busy": "2022-11-02T17:05:17.505035Z", "iopub.status.idle": "2022-11-02T17:05:17.512861Z", "shell.execute_reply": "2022-11-02T17:05:17.511811Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 9.79692804, 10.51272714, 10.55855562])" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "direct = delta_hat + rho_hat * ma_res.resid[-4:-1]\n", "direct" ] }, { "cell_type": "markdown", "id": "9c64c4b6-3062-403d-90e8-2bbfd8923ae7", "metadata": {}, "source": [ "The \"direct\" forecasts are identical. This happens since the effect of the short sample has disappeared by the end of the sample (In practice it is negligible by observations 100 or so, and numerically absent by around observation 160)." ] }, { "cell_type": "code", "execution_count": 28, "id": "0b61fde0-17fb-4678-9267-c624c49ee26e", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.519245Z", "iopub.status.busy": "2022-11-02T17:05:17.518881Z", "iopub.status.idle": "2022-11-02T17:05:17.525600Z", "shell.execute_reply": "2022-11-02T17:05:17.525046Z" } }, "outputs": [ { "data": { "text/plain": [ "array([0., 0., 0.])" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ma_res.predict(t - 3, t - 1) - direct" ] }, { "cell_type": "markdown", "id": "1e7a2a2d-e7db-4b4a-8fb9-408ff21256d3", "metadata": {}, "source": [ "The same principle applies in more complicated model that include multiple lags or seasonal term - predictions in AR models are simple once the effective lag length has been reached, while predictions in models that contains MA components are only simple once the maximum root of the MA lag polynomial is sufficiently small so that the residuals are close to the true residuals. " ] }, { "cell_type": "markdown", "id": "8c2e2caa-bd34-4f9c-8272-e8fcb389ef03", "metadata": {}, "source": [ "### Prediction differences in `SARIMAX` and `ARIMA`\n", "\n", "The formulas used to make predictions from `SARIMAX` and `ARIMA` models differ in one key aspect - `ARIMA` treats all trend terms, e.g, the intercept or time trend, as part of the exogenous regressors. For example, an AR(1) model with an intercept and linear time trend estimated using `ARIMA` has the specification\n", "\n", "$$\n", "\\begin{align*}\n", "Y_t - \\delta_0 - \\delta_1 t & = \\epsilon_t \\\\\n", "\\epsilon_t & = \\rho \\epsilon_{t-1} + \\eta_t\n", "\\end{align*}\n", "$$\n", "\n", "When the same model is estimated using `SARIMAX`, the specification is \n", "\n", "$$\n", "\\begin{align*}\n", "Y_t & = \\epsilon_t \\\\\n", "\\epsilon_t & = \\delta_0 + \\delta_1 t + \\rho \\epsilon_{t-1} + \\eta_t\n", "\\end{align*}\n", "$$\n", "\n", "The differences are more apparent when the model contains exogenous regressors, $X_t$. The `ARIMA` specification is\n", "\n", "$$\n", "\\begin{align*}\n", "Y_t - \\delta_0 - \\delta_1 t - X_t \\beta & = \\epsilon_t \\\\\n", "\\epsilon_t & = \\rho \\epsilon_{t-1} + \\eta_t \\\\\n", " & = \\rho \\left(Y_{t-1} - \\delta_0 - \\delta_1 (t-1) - X_{t-1} \\beta\\right) + \\eta_t\n", "\\end{align*}\n", "$$\n", "\n", "while the `SARIMAX` specification is \n", "\n", "$$\n", "\\begin{align*}\n", "Y_t & = X_t \\beta + \\epsilon_t \\\\\n", "\\epsilon_t & = \\delta_0 + \\delta_1 t + \\rho \\epsilon_{t-1} + \\eta_t \\\\\n", " & = \\delta_0 + \\delta_1 t + \\rho \\left(Y_{t-1} - X_{t-1}\\beta\\right) + \\eta_t\n", "\\end{align*}\n", "$$\n", "\n", "The key difference between these two is that the intercept and the trend are effectively equivalent to exogenous regressions in `ARIMA` while they are more like standard ARMA terms in `SARIMAX`.\n", "\n", "The next cell simulates an ARX with a time trend using the specification in `ARIMA` and estimates the parameters using both estimators." ] }, { "cell_type": "code", "execution_count": 29, "id": "f9e9004b-35c0-4005-8520-358e2462514b", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.531465Z", "iopub.status.busy": "2022-11-02T17:05:17.531100Z", "iopub.status.idle": "2022-11-02T17:05:17.541888Z", "shell.execute_reply": "2022-11-02T17:05:17.541333Z" } }, "outputs": [], "source": [ "rho = 0.8\n", "beta = 2\n", "delta0 = 10\n", "delta1 = 0.5\n", "epsilon = eta.copy()\n", "for i in range(1, eta.shape[0]):\n", " epsilon[i] = rho * epsilon[i - 1] + eta[i]\n", "t = np.arange(epsilon.shape[0])\n", "y = delta0 + delta1 * t + beta * full_x + epsilon\n", "y = y[200:]" ] }, { "cell_type": "code", "execution_count": 30, "id": "c9a06c47-d73e-486b-9d36-0c27029e2920", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:17.545980Z", "iopub.status.busy": "2022-11-02T17:05:17.545141Z", "iopub.status.idle": "2022-11-02T17:05:25.637933Z", "shell.execute_reply": "2022-11-02T17:05:25.637268Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Optimization terminated successfully.\n", " Current function value: 1.413691\n", " Iterations: 46\n", " Function evaluations: 58\n", " Gradient evaluations: 58\n" ] } ], "source": [ "start = np.array([110, delta1, beta, rho, 1])\n", "arx_res = ARIMA(y, exog=x, order=(1, 0, 0), trend=\"ct\").fit()\n", "mod = SARIMAX(y, exog=x, order=(1, 0, 0), trend=\"ct\")\n", "start[:2] *= 1 - rho\n", "sarimax_res = mod.fit(start_params=start, method=\"bfgs\")" ] }, { "cell_type": "markdown", "id": "ff71109f-b71a-4a45-9068-8a73969d4892", "metadata": {}, "source": [ "The two estimators fit similarly, although there is a small difference in the log-likelihood. This is a numerical issue and should not materially affect the predictions. Importantly the two trend parameters, `const` and `x1` (unfortunately named for the time trend), differ between the two. The other parameters are effectively identical." ] }, { "cell_type": "code", "execution_count": 31, "id": "84ffc296-0c6c-4052-98db-b6c9420e9a92", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:25.644420Z", "iopub.status.busy": "2022-11-02T17:05:25.642727Z", "iopub.status.idle": "2022-11-02T17:05:25.670496Z", "shell.execute_reply": "2022-11-02T17:05:25.669876Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " SARIMAX Results \n", "==============================================================================\n", "Dep. Variable: y No. Observations: 5000\n", "Model: ARIMA(1, 0, 0) Log Likelihood -7069.171\n", "Date: Wed, 02 Nov 2022 AIC 14148.343\n", "Time: 17:05:25 BIC 14180.928\n", "Sample: 0 HQIC 14159.763\n", " - 5000 \n", "Covariance Type: opg \n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", "------------------------------------------------------------------------------\n", "const 109.2112 0.137 796.186 0.000 108.942 109.480\n", "x1 0.5000 4.78e-05 1.05e+04 0.000 0.500 0.500\n", "x2 2.0495 0.011 187.517 0.000 2.028 2.071\n", "ar.L1 0.7965 0.009 93.669 0.000 0.780 0.813\n", "sigma2 0.9897 0.020 49.854 0.000 0.951 1.029\n", "===================================================================================\n", "Ljung-Box (L1) (Q): 0.33 Jarque-Bera (JB): 0.15\n", "Prob(Q): 0.57 Prob(JB): 0.93\n", "Heteroskedasticity (H): 0.97 Skew: -0.01\n", "Prob(H) (two-sided): 0.53 Kurtosis: 3.00\n", "===================================================================================\n", "\n", "Warnings:\n", "[1] Covariance matrix calculated using the outer product of gradients (complex-step).\n" ] } ], "source": [ "print(arx_res.summary())" ] }, { "cell_type": "code", "execution_count": 32, "id": "b158f625-0d67-4fed-bd0e-fae961395b69", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:25.676569Z", "iopub.status.busy": "2022-11-02T17:05:25.674506Z", "iopub.status.idle": "2022-11-02T17:05:25.702529Z", "shell.execute_reply": "2022-11-02T17:05:25.701952Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " SARIMAX Results \n", "==============================================================================\n", "Dep. Variable: y No. Observations: 5000\n", "Model: SARIMAX(1, 0, 0) Log Likelihood -7068.457\n", "Date: Wed, 02 Nov 2022 AIC 14146.914\n", "Time: 17:05:25 BIC 14179.500\n", "Sample: 0 HQIC 14158.335\n", " - 5000 \n", "Covariance Type: opg \n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", "------------------------------------------------------------------------------\n", "intercept 22.7438 0.929 24.481 0.000 20.923 24.565\n", "drift 0.1019 0.004 23.985 0.000 0.094 0.110\n", "x1 2.0230 0.011 185.290 0.000 2.002 2.044\n", "ar.L1 0.7963 0.008 93.745 0.000 0.780 0.813\n", "sigma2 0.9894 0.020 49.899 0.000 0.951 1.028\n", "===================================================================================\n", "Ljung-Box (L1) (Q): 0.47 Jarque-Bera (JB): 0.13\n", "Prob(Q): 0.49 Prob(JB): 0.94\n", "Heteroskedasticity (H): 0.97 Skew: -0.01\n", "Prob(H) (two-sided): 0.47 Kurtosis: 3.00\n", "===================================================================================\n", "\n", "Warnings:\n", "[1] Covariance matrix calculated using the outer product of gradients (complex-step).\n" ] } ], "source": [ "print(sarimax_res.summary())" ] }, { "cell_type": "markdown", "id": "f6b2a9e4-3796-44f1-9476-bf2da357d8b3", "metadata": {}, "source": [ "## Initial residuals `SARIMAX` and `ARIMA`\n", "\n", "Residuals for observations before the maximal model order, which depends on the AR, MA, Seasonal AR, Seasonal MA and differencing parameters, are not reliable and should not be used for performance assessment. In general, in an ARIMA with orders $(p,d,q)\\times(P,D,Q,s)$, the formula for residuals that are less well behaved is:\n", "\n", "$$\n", "\\max((P+D)s+p+d,Qs+q)\n", "$$\n", "\n", "We can simulate some data from an ARIMA(1,0,0)(1,0,0,12) and examine the residuals." ] }, { "cell_type": "code", "execution_count": 33, "id": "43f9387d-b431-4079-b98a-2a76f7e9595a", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:25.708239Z", "iopub.status.busy": "2022-11-02T17:05:25.706641Z", "iopub.status.idle": "2022-11-02T17:05:25.726184Z", "shell.execute_reply": "2022-11-02T17:05:25.725576Z" } }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "rho = 0.8\n", "psi = -0.6\n", "beta = 20\n", "epsilon = eta.copy()\n", "for i in range(13, eta.shape[0]):\n", " epsilon[i] = (\n", " rho * epsilon[i - 1]\n", " + psi * epsilon[i - 12]\n", " - (rho * psi) * epsilon[i - 13]\n", " + eta[i]\n", " )\n", "y = beta + epsilon\n", "y = y[200:]" ] }, { "cell_type": "markdown", "id": "b8f3e2ca-8022-4940-b1a9-ed5d245c73c7", "metadata": {}, "source": [ "With a large sample, the parameter estimates are very close to the DGP parameters." ] }, { "cell_type": "code", "execution_count": 34, "id": "3bcefc73-cfc4-4ae0-9af0-f55aa83bee99", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:25.731945Z", "iopub.status.busy": "2022-11-02T17:05:25.730321Z", "iopub.status.idle": "2022-11-02T17:05:28.310885Z", "shell.execute_reply": "2022-11-02T17:05:28.310227Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " SARIMAX Results \n", "========================================================================================\n", "Dep. Variable: y No. Observations: 5000\n", "Model: ARIMA(1, 0, 0)x(1, 0, 0, 12) Log Likelihood -7076.266\n", "Date: Wed, 02 Nov 2022 AIC 14160.532\n", "Time: 17:05:28 BIC 14186.600\n", "Sample: 0 HQIC 14169.668\n", " - 5000 \n", "Covariance Type: opg \n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", "------------------------------------------------------------------------------\n", "const 19.8586 0.043 458.609 0.000 19.774 19.943\n", "ar.L1 0.7972 0.008 93.925 0.000 0.781 0.814\n", "ar.S.L12 -0.6044 0.011 -53.280 0.000 -0.627 -0.582\n", "sigma2 0.9914 0.020 49.899 0.000 0.952 1.030\n", "===================================================================================\n", "Ljung-Box (L1) (Q): 0.50 Jarque-Bera (JB): 0.11\n", "Prob(Q): 0.48 Prob(JB): 0.95\n", "Heteroskedasticity (H): 0.96 Skew: -0.01\n", "Prob(H) (two-sided): 0.40 Kurtosis: 2.99\n", "===================================================================================\n", "\n", "Warnings:\n", "[1] Covariance matrix calculated using the outer product of gradients (complex-step).\n" ] } ], "source": [ "res = ARIMA(y, order=(1, 0, 0), trend=\"c\", seasonal_order=(1, 0, 0, 12)).fit()\n", "print(res.summary())" ] }, { "cell_type": "markdown", "id": "0eafd7c5-a796-40a1-b460-9a9163686c3b", "metadata": {}, "source": [ "We can first examine the initial 13 residuals by plotting against the actual shocks in the model. While there is a correspondence, it is fairly weak and the correlation is much less than 1." ] }, { "cell_type": "code", "execution_count": 35, "id": "9cc7fe30-4e40-468a-930e-14bf0aa0d929", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:28.317738Z", "iopub.status.busy": "2022-11-02T17:05:28.316021Z", "iopub.status.idle": "2022-11-02T17:05:28.636086Z", "shell.execute_reply": "2022-11-02T17:05:28.635447Z" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1QAAAMyCAYAAABqzIAaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAABBDElEQVR4nO3df5jXdZ3v/8cAyrQwM4pITEqASiZil5cp2qVHQAtYTmxr6iV1THGP5erVWTtwnVN4Oots1wnd4267256L1eWUFJl5Dl0WpWCbQGmr2KJdEZHEApkOsco2Axgjwnz/YGe+zpkBmZfD5zMDt9t1zVWf9/v9eX+ew/W5vLjz/lXT1tbWFgAAAHpsQLUHAAAA6K8EFQAAQCFBBQAAUEhQAQAAFBJUAAAAhQQVAABAIUEFAABQaFC1B+grDhw4kJdeeil1dXWpqamp9jgAAECVtLW1ZdeuXXnHO96RAQMOfwxKUP2bl156KaNGjar2GAAAQB/xwgsv5PTTTz/sNoLq39TV1SU5+IdWX19f5WkAAIBqaWlpyahRozoa4XAE1b9pP82vvr5eUAEAA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aqxdeeMEpgRwx3xtK+N5QwveGEr43lDgevjdtbW3ZtWtX3vGOd2TAgMPfx69iR6g2btyYq666Kq2trZk8eXK+/vWvd9lmzJgxmT17dsfrF198Meecc05Gjx6drVu3dix/8MEH85d/+Ze5/PLLM3r06AwZMiTPP/98Hnnkkezbty/z5s3rUUwlyYABA3L66ae/6Xb19fXH7BeHo8f3hhK+N5TwvaGE7w0ljvXvzZsdmWpXsaDavn17x131HnzwwW63mTRpUqegOpQpU6bk5z//eZ599tn88Ic/zKuvvprhw4dnxowZue2223r8PCsAAIASFQuqyZMnH9FFXW80ZsyYbt8zadKkTJo0qbdGAwAAKFL1B/v2F4MHD878+fMzePDgao9CP+J7QwnfG0r43lDC94YSvjedVfSmFAAAAMcSR6gAAAAKCSoAAIBCggoAAKCQoAIAACgkqAAAAAoJqgJf+9rXctVVV+XMM89MXV1dhg4dmnPPPTf/+T//57z44ovVHo8+aN++fVm2bFluvPHGnHPOORk6dGjq6upy8cUXZ9GiRdm/f3+1R6SPeu6553LHHXdk2rRpOfXUU1NTU5PJkydXeyz6kGeeeSYzZszISSedlCFDhuSSSy7JQw89VO2x6MOWLl2aW265JRdeeGEGDx6cmpqa3H///dUeiz7sxRdfzF/91V9l6tSpeec735kTTzwxI0eOzNVXX52nn3662uNVndumF5g5c2Y2bdqU9773vWlsbExbW1uee+65rFq1Kg0NDXniiSdy7rnnVntM+pCNGzd2hNSVV16Zs88+O83NzVm+fHleeumlfPCDH8y3v/3t1NTUVHtU+pg777wzCxYsyIknnph3vetdWb9+fSZNmpTVq1dXezT6gFWrVmXatGmpra3NrFmzUldXl2XLlmXbtm255557Mnfu3GqPSB80ZsyYbNu2LcOHD8+QIUOybdu2fPnLX87s2bOrPRp91Gc+85ncfffdOfPMMzN58uSceuqp2bRpUx5++OG0tbXlgQceyHXXXVftMatGUBXYu3dvamtruyz/3//7f+fmm2/ONddck//zf/5PFSajr3rxxRfzrW99KzfeeGOGDBnSsXzPnj2ZPHlyfvzjH+ehhx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VGA04Rh04cCA33XRTvvKVr+QjH/lI7r///gwY4B53/gR62UsvvZQkjk7RrfaYGjZsWFatWpWzzjqr2iMB/VT7LYwfe+yxLutWrlzZaRuAt+qNMXXdddflq1/96nF93dQbCaoe2rVrV37xi190u+5LX/pS1q5dm3HjxvmLMl08+uijufrqq3PyySdn1apVTukC3pIrr7wyZ5xxRh544IE899xzHcubm5vz+c9/PieeeGJuuOGG6g0IHDPaT/P7yle+kmuvvTZLly4VU29Q09bW1lbtIfqTrVu35owzzsiFF16Yd7/73TnttNPyr//6r3nmmWeybt261NfXZ8WKFXnf+95X7VHpQzZu3Jjzzz8/ra2tmTVrVs4+++wu24wZM8ZT6uli48aNueuuu5Ikv/vd7/LQQw/l7W9/e6ZPn96xzf3331+l6ai2VatWZdq0aamtrc2sWbNSV1eXZcuWZdu2bbnnnnsyd+7cao9IH7R48eI88cQTSZKf/vSnWbduXS699NKOfwy+7LLLcvPNN1dzRPqYO++8MwsWLMjQoUNz++23d/vMqT/8wz/s9JDx44mg6qE9e/bkz//8z7N69eo8//zzeeWVV3LiiSdmzJgxmTp1aubMmZPTTz+92mPSx6xevTpTpkw57DaTJk3qeFAntDuS747/jB/f1q5dm/nz5+dHP/pR9u3bl/POOy9z5szJddddV+3R6KNmz56dJUuWHHL9jTfe6B9q6OTNvjNJ8uUvf/m4/YdhQQUAAFDINVQAAACFBBUAAEAhQQUAAFBIUAEAABQSVAAAAIUEFQAAQCFBBQAAUEhQAQAAFBJUAAAAhQQVAABAIUEFAABQSFABAAAU+v8ANJiip9uOCt8AAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import matplotlib.pyplot as plt\n", "\n", "plt.rc(\"figure\", figsize=(10, 10))\n", "plt.rc(\"font\", size=14)\n", "\n", "_ = plt.scatter(res.resid[:13], eta[200 : 200 + 13])" ] }, { "cell_type": "markdown", "id": "1af117bd-a51c-496a-bf1d-0c08a88a8101", "metadata": {}, "source": [ "Looking at the next 24 residuals and shocks, we see there is nearly perfect correlation. This is expected in large samples once the less accurate residuals are ignored." ] }, { "cell_type": "code", "execution_count": 36, "id": "12b89d33-1cf2-435a-9dc8-ef04d2d6f8ba", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:28.641663Z", "iopub.status.busy": "2022-11-02T17:05:28.640491Z", "iopub.status.idle": "2022-11-02T17:05:28.979697Z", "shell.execute_reply": "2022-11-02T17:05:28.978926Z" } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAA1QAAAMyCAYAAABqzIAaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy89olMNAAAACXBIWXMAAA9hAAAPYQGoP6dpAABI9klEQVR4nO3df3RV5Z3o/88JYEIhiSJiojLhR6ktoOOiSnXhFfEHUKeM09Ze0Wtbeq+V0tWZeuXOWLztBKZrir3j7S+ni9GyqrTUtn4XXba0FuhUoFesokU7pUilFClKKMWMCUQTMDnfP5hkTJNA8nByTn68XmtlLc8+OzvPYSfBN/s5z85ks9lsAAAA0GNFhR4AAABAfyWoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEQws9gL6ipaUl9u/fH6WlpZHJZAo9HAAAoECy2WwcPnw4zjnnnCgqOvE1KEH1H/bv3x9jx44t9DAAAIA+Yt++fXHeeeedcB9B9R9KS0sj4vgfWllZWYFHAwAAFEp9fX2MHTu2rRFORFD9h9ZpfmVlZYIKAADo1luBLEoBAACQSFABAAAkElQAAACJBBUAAEAiQQUAAJBIUAEAACQSVAAAAIkEFQAAQCJBBQAAkEhQAQAAJBJUAAAAiQQVAABAIkEFAACQSFABAAAkElQAAACJBBUAAEAiQQUAAJBIUAEAACQSVAAAAIkEFQAAQCJBBQAAkEhQAQAAJBJUAAAAiQQVAABAIkEFAACQSFABAAAkElQAAACJhhZ6AAAAwODW3JKNrXtq4+DhxhhTWhLTx4+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3d3i+9b1T7kMFAAD0pn4ZVBERM2fOjIaGhtiyZUuH59avXx8REVdccUW+hwUAAAwifT6oDh06FDt37oxDhw61237bbbdFRMRnPvOZOHr0aNv2H//4x7Fp06aYPXt2VFVV5XWsAADA4FKQ91CtXLkyHn/88YiI+NWvftW2bdOmTRERcfnll8ett94aERH//M//HMuWLYvq6upYunRp2zFmzZoVt956a6xcuTKmTZsWf/EXfxE1NTXx3e9+N0aNGhX33ntvXl8TAAAw+BQkqB5//PFYtWpVu21btmxpN32vNahO5L777osLLrgg7r///vjyl78cI0eOjPe+973xj//4jzFx4sScjxsAAODNMtlsNlvoQfQF9fX1UV5eHnV1dW33sQIAAAafnrRBn38PFQAAQF8lqAAAABIJKgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACCRoAIAAEgkqAAAABIJKgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACCRoAIAAEgkqAAAABIJKgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACCRoAIAAEgkqAAAABIJKgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACCRoAIAAEgkqAAAABIJKgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACCRoAIAAEgkqAAAABIJKgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACDR0EIPAACgP2tuycbWPbVx8HBjjCktienjR8WQokyhhwXkiaACAEi0bntNLFu7I2rqGtu2VZaXRPW8yTF3amUBRwbkiyl/AAA91NySjS//66742Opt7WIqIuJAXWMsWr0t1m2vKdDogHxyhQoAoAfWba+JpT/4dRyob+r0+WxEZCJi2dodce3kCtP/YIBzhQoAoJvW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9dff32n3+f+TuieT3/607F3794YPXp0VFZWxt69e5OOs3Dhwli5cmVMmTIl/uZv/ib2798fDz/8cGzYsCGefPLJmDRpUo5HPvDk6lxERMycObPTfzD1d8KbZDmhl156KfvVr341e+TIkXbbjxw5kr344ouzEZF9+OGHu3WsY8eOZSdOnJgtLi7OPvvss23bX3311ezb3va27GmnnZZ98cUXczn8AWf79u3ZX/ziF9mjR49ma2pqshGRnTlzZtKxqqqqslVVVTkd32CSq3Ph5+LU/f3f/302IrJ33nlnu+133nlnNiKyn/vc57p9rFP5mRoscvU9+/Wvfz0bEdmbbrop29LS0rZ9xYoV2YjI3nbbbb0x/AElV+figQceyEZE9oEHHui9wQ4CP/nJT9r+vJcvX570Z/rYY49lIyJ7xRVXZJuamtq2P/roo9mIyM6ePTuXQx6wcnEuNm7cmI2IbHV1de4HOMCY8ncS5557bnz84x+PESNGtNs+YsSIuOOOOyIiYvPmzd061mOPPRa7d++Om2++uV3Vl5eXx1133RVHjx6NVatW5WzsA9GUKVNi2rRpMWzYsEIPZdDL1bnwc3FqstlsrFy5MkaOHBmf+cxn2j33mc98JkaOHBkrV64s0OgGplx9z37ta1+LiIjly5e3m+WwcOHCmDBhQnzrW9+K119/PefjH0j8/uhbrrnmmqiqqjqlY7T+XHz2s5+N0047rW37u9/97rjyyitjw4YN8fvf//6UvsZgkItzQfeZ8ncKWv9HcujQ7v0xts7Bnj17dofn5syZExHdjzNyo6mpKR588MHYv39/lJWVxSWXXBLvete7Cj2sQcXPxanZtWtX7N+/P+bMmdPpP/zMmDEj1q9fH/v27YuxY8d265ivvvpq3H///XHo0KEYNWpUzJgxIy644ILeGH6/lIvv2cbGxnjqqafi/PPP7/A/PZlMJq699tq477774plnnon/8l/+S24GPgDl+vfHs88+G6+88kq88cYbMW7cuLjmmmvizDPPzMlY6Z5Nmza1/e76U3PmzIlNmzbF5s2b44Mf/GABRjc47dq1K770pS/F66+/Huedd15cddVVce655xZ6WH2KoDoFX//61yOi81/kndm1a1dERKdz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43ve+F+PGjYunnnoqzjrrrAK8uv4lF+cik8nEhRdeGBdeeGGce+65UVtbG5s3b44XXnghzjvvvNi8eXOPp/kPRitXrozHH388IiJ+9atfxbZt22LGjBlts3ouv/zyuPXWWyPi+N/Dy5Yti+rq6li6dGm743z0ox+NlStXxpQpU+Iv/uIvoqamJr773e/GyJEj4+c//3m87W1vy+vr6o9ycS7GjRsXw4YNi4svvjjOO++8aGhoiCeffDKeffbZOP3002P9+vWDYkp+txS66Pq6jRs3ZiPihB9/+q/ye/bsyUZEtqqqqtNjPvXUU9m5c+dmy8rKssOHD89Onz49+53vfKf3X8wA0J3z8WZdnYtNmzZl/+t//a/ZSZMmZcvKyrJDhw7NVlRUZK+//vrs+vXr8/iK+q9cnYtWfi5Ozauvvpq9/fbbs2PHjs0OGzYs+2d/9mfZxYsXZ+vr6zvs23ru/vR31/e+973s9ddfnx0/fnx2xIgR2WHDhmXHjh2bvemmm7JPPfVUnl5J/9Hd79kPf/jDXf7rcGNjY3bp0qXZiRMnZk877bRsRUVF9tZbb80eOHAgD69g4DjVc7F48eLsjBkzsmeffXZ22LBh2REjRmT//M//PPvpT386W1tbm6dX0f+1/vl29fHhD3+4bd/q6upsRGSrq6s7HKe5uTn75S9/OTtlypRscXFx9swzz8zeeOONrpD3QC7Oxd13352dNWtW9pxzzskWFxdnhw8fnn3729+evf3227P79u3L7wvq41yhAgAASGRRCgAAgESCCgAAIJGgAgAASCSoAAAAEgkqAACARIIKAAAgkaACAABIJKgAAAASCSoAAIBEggoAACCRoAIAAEgkqAAAABL9/x+paMcL7O4kAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "_ = plt.scatter(res.resid[13:37], eta[200 + 13 : 200 + 37])" ] }, { "cell_type": "markdown", "id": "b4a381b2-fcc4-44ee-901c-109cdc02a1f1", "metadata": {}, "source": [ "Next, we simulate an ARIMA(1,1,0), and include a time trend." ] }, { "cell_type": "code", "execution_count": 37, "id": "790f834c-8b13-4475-9a09-aea19ace79fe", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:28.983311Z", "iopub.status.busy": "2022-11-02T17:05:28.982975Z", "iopub.status.idle": "2022-11-02T17:05:28.995671Z", "shell.execute_reply": "2022-11-02T17:05:28.995007Z" } }, "outputs": [], "source": [ "rng = np.random.default_rng(20210819)\n", "eta = rng.standard_normal(5200)\n", "rho = 0.8\n", "beta = 20\n", "epsilon = eta.copy()\n", "for i in range(2, eta.shape[0]):\n", " epsilon[i] = (1 + rho) * epsilon[i - 1] - rho * epsilon[i - 2] + eta[i]\n", "t = np.arange(epsilon.shape[0])\n", "y = beta + 2 * t + epsilon\n", "y = y[200:]" ] }, { "cell_type": "markdown", "id": "5521dfb2-3bcc-4a28-b2df-f92e95fe4259", "metadata": {}, "source": [ "Again the parameter estimates are very close to the DGP parameters." ] }, { "cell_type": "code", "execution_count": 38, "id": "3d56ebbb-2143-4582-8409-df1c9026a3df", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:28.998801Z", "iopub.status.busy": "2022-11-02T17:05:28.998575Z", "iopub.status.idle": "2022-11-02T17:05:29.314556Z", "shell.execute_reply": "2022-11-02T17:05:29.313707Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " SARIMAX Results \n", "==============================================================================\n", "Dep. Variable: y No. Observations: 5000\n", "Model: ARIMA(1, 1, 0) Log Likelihood -7067.739\n", "Date: Wed, 02 Nov 2022 AIC 14141.479\n", "Time: 17:05:29 BIC 14161.030\n", "Sample: 0 HQIC 14148.331\n", " - 5000 \n", "Covariance Type: opg \n", "==============================================================================\n", " coef std err z P>|z| [0.025 0.975]\n", "------------------------------------------------------------------------------\n", "x1 1.7747 0.069 25.642 0.000 1.639 1.910\n", "ar.L1 0.7968 0.009 93.658 0.000 0.780 0.813\n", "sigma2 0.9896 0.020 49.908 0.000 0.951 1.028\n", "===================================================================================\n", "Ljung-Box (L1) (Q): 0.43 Jarque-Bera (JB): 0.09\n", "Prob(Q): 0.51 Prob(JB): 0.96\n", "Heteroskedasticity (H): 0.97 Skew: -0.01\n", "Prob(H) (two-sided): 0.47 Kurtosis: 2.99\n", "===================================================================================\n", "\n", "Warnings:\n", "[1] Covariance matrix calculated using the outer product of gradients (complex-step).\n" ] } ], "source": [ "res = ARIMA(y, order=(1, 1, 0), trend=\"t\").fit()\n", "print(res.summary())" ] }, { "cell_type": "markdown", "id": "d9626a1d-b742-4a48-b2e5-e10be84e01c7", "metadata": {}, "source": [ "The residuals are not accurate, and the first residual is approximately 500. The others are closer, although in this model the first 2 should usually be ignored." ] }, { "cell_type": "code", "execution_count": 39, "id": "48a1b52b-6506-4e8d-aad5-4d8f80c65f79", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:29.318149Z", "iopub.status.busy": "2022-11-02T17:05:29.317790Z", "iopub.status.idle": "2022-11-02T17:05:29.324148Z", "shell.execute_reply": "2022-11-02T17:05:29.323372Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 5.08403002e+02, -1.58904197e+00, -1.54902445e+00, 1.04992619e-01,\n", " 1.33644383e+00])" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res.resid[:5]" ] }, { "cell_type": "markdown", "id": "138445dd-e028-4e29-958f-6ab9f4efe674", "metadata": {}, "source": [ "The reason why the first residual is so large is that the optimal prediction of this value is the mean of the difference, which is 1.77. Once the first value is known, the second value makes use of the first value in its prediction and the prediction is substantially closer to the truth." ] }, { "cell_type": "code", "execution_count": 40, "id": "11088c2a-9d7e-4d88-ac26-48a5b5df6867", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:29.327325Z", "iopub.status.busy": "2022-11-02T17:05:29.326953Z", "iopub.status.idle": "2022-11-02T17:05:29.333616Z", "shell.execute_reply": "2022-11-02T17:05:29.332866Z" } }, "outputs": [ { "data": { "text/plain": [ "array([ 1.77472563, 511.95355129, 510.87392196, 508.85708934,\n", " 509.03356182, 511.85245439])" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res.predict(0, 5)" ] }, { "cell_type": "markdown", "id": "cf626404-fbd8-42ab-b6b2-5ffcad3e7b51", "metadata": {}, "source": [ "It is worth noting that the results class contains two parameters than can be helpful in understanding which residuals are problematic, `loglikelihood_burn` and `nobs_diffuse`." ] }, { "cell_type": "code", "execution_count": 41, "id": "947f58ee-44bb-45d6-88c9-6757b0be1481", "metadata": { "execution": { "iopub.execute_input": "2022-11-02T17:05:29.336610Z", "iopub.status.busy": "2022-11-02T17:05:29.336243Z", "iopub.status.idle": "2022-11-02T17:05:29.340812Z", "shell.execute_reply": "2022-11-02T17:05:29.340120Z" } }, "outputs": [ { "data": { "text/plain": [ "(1, 0)" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res.loglikelihood_burn, res.nobs_diffuse" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" } }, "nbformat": 4, "nbformat_minor": 5 }