ARIMA, VAR and cointegration tests
ARIMA and seasonal ARIMA fits and forecasts with intervals, VARs with lag selection, orthogonalized impulse responses and variance decompositions, and the Engle-Granger and Johansen cointegration tests, over statsmodels.
- Model id
econometrics.time_series, version 1- Domain
- Econometrics
- Evidence
- standard
- Cost class
- heavy: Estimation or simulation; a hosted run may take up to 30 seconds.
- Needs
pip install "pyeconomics[econometrics]"
Formula
Where
- The series at time t; in the VAR, the vector of series
series - The lag operator: L y_t is y_{t-1}
- The autoregressive polynomial
ar - The seasonal autoregressive polynomial
seasonal_ar - The moving-average polynomial
ma - The seasonal moving-average polynomial
seasonal_ma - Number of differences
differences - Number of seasonal differences
seasonal_differences - Periods in a season
season - The constant or trend term
trend - The innovation at time t
- The innovations' variance
- The VAR's intercepts
- The VAR's coefficient matrix at lag 1; A_p is the matrix at lag p
coefficients - Number of lags in the VAR
lags - The VAR's residuals at time t
- Covariance matrix of the VAR's residuals
residual_covariance - The lower-triangular Cholesky factor of the residual covariance
- The moving-average coefficient matrix at horizon h
- The orthogonalized impulse responses at horizon h
impulse_responses - The share of series i's forecast-error variance at horizon h due to shocks to series j
variance_decomposition - The cointegrating coefficients
- The other series at time t
- The residual of the cointegrating regression
- The coefficient the Engle-Granger test is on: negative when the residual reverts
- Number of lagged differences in the test regression
- Johansen's trace statistic for at most r cointegrating relations
trace_statistics - Johansen's maximum-eigenvalue statistic for r against r + 1 relations
max_eigenvalue_statistics - The i-th largest eigenvalue
eigenvalues - Number of observations
observations - Number of series
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
ARIMA or seasonal ARIMA (Box and Jenkins) (arima): 13 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Seriesseriesratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The first (or only) variable, oldest first, in its own units |
Namesnamestext (array) · length max 6; each at most 32 characters | text (array) | length max 6; each at most 32 characters | A name for each variable; the field names when null |
Calculationcalculationtext | text | ARIMA or seasonal ARIMA (Box and Jenkins) | |
Ararcount · [0, 4] | count | [0, 4] | Autoregressive order, p |
Differencesdifferencescount · [0, 2] | count | [0, 2] | Order of differencing, d |
Mamacount · [0, 4] | count | [0, 4] | Moving-average order, q |
Seasonal arseasonal_arcount · [0, 2] | count | [0, 2] | Seasonal autoregressive order, P |
Seasonal differencesseasonal_differencescount · [0, 1] | count | [0, 1] | Order of seasonal differencing, D |
Seasonal maseasonal_macount · [0, 2] | count | [0, 2] | Seasonal moving-average order, Q |
Seasonseasoncount · [0, 12] | count | [0, 12] | Periods in a season, s (12 for months); 0 for no seasonal part |
Trendtrendtext | text | Deterministic terms: none, a constant, a linear trend or both; null for a constant without differencing and none with it | |
Horizonhorizoncount · [1, 120] | count | [1, 120] | Periods to forecast |
Alphaalphaprobability · [0.001, 0.5] | probability | [0.001, 0.5] | 1 - the forecast intervals' coverage |
A vector autoregression (Sims 1980; Lütkepohl 2005) (var): 13 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Seriesseriesratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The first (or only) variable, oldest first, in its own units |
Namesnamestext (array) · length max 6; each at most 32 characters | text (array) | length max 6; each at most 32 characters | A name for each variable; the field names when null |
Secondsecondratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The second variable, in its own units |
Thirdthirdratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The third variable, if any |
Fourthfourthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The fourth variable, if any |
Fifthfifthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The fifth variable, if any |
Sixthsixthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The sixth variable, if any |
Calculationcalculationtext | text | A vector autoregression (Sims 1980; Lütkepohl 2005) | |
Lagslagscount · [1, 12] | count | [1, 12] | The lag order; null chooses it by criterion up to max_lags |
Max lagsmax_lagscount · [1, 12] | count | [1, 12] | The longest lag order the criterion tries |
Criterioncriteriontext | text | Lag selection: Akaike, Schwarz (BIC) or Hannan-Quinn | |
Trendtrendtext | text | Deterministic terms: none, a constant, or both and a trend | |
Horizonhorizoncount · [1, 60] | count | [1, 60] | Periods of the impulse responses and variance decomposition |
The Engle-Granger two-step test (engle_granger): 11 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Seriesseriesratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The first (or only) variable, oldest first, in its own units |
Namesnamestext (array) · length max 6; each at most 32 characters | text (array) | length max 6; each at most 32 characters | A name for each variable; the field names when null |
Secondsecondratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The second variable, in its own units |
Thirdthirdratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The third variable, if any |
Fourthfourthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The fourth variable, if any |
Fifthfifthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The fifth variable, if any |
Sixthsixthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The sixth variable, if any |
Calculationcalculationtext | text | The Engle-Granger two-step test | |
Trendtrendtext | text | Deterministic terms of the cointegrating regression: a constant, a linear trend, or a quadratic one | |
Max lagsmax_lagscount · [0, 24] | count | [0, 24] | The most ADF lags; null for min(24, ceil(12 (n / 100)^(1/4))) |
Lag criterionlag_criteriontext | text | Chooses the ADF lags up to max_lags; null uses max_lags |
Johansen's trace and maximum-eigenvalue tests (johansen): 11 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Seriesseriesratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The first (or only) variable, oldest first, in its own units |
Namesnamestext (array) · length max 6; each at most 32 characters | text (array) | length max 6; each at most 32 characters | A name for each variable; the field names when null |
Secondsecondratio (array) · length min 3, max 2000; each [-1e+09, 1e+09] | ratio (array) | length min 3, max 2000; each [-1e+09, 1e+09] | The second variable, in its own units |
Thirdthirdratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The third variable, if any |
Fourthfourthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The fourth variable, if any |
Fifthfifthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The fifth variable, if any |
Sixthsixthratio (array) · each [-1e+09, 1e+09] | ratio (array) | each [-1e+09, 1e+09] | The sixth variable, if any |
Calculationcalculationtext | text | Johansen's trace and maximum-eigenvalue tests | |
Deterministicdeterministictext | text | Deterministic terms: none, a constant or a linear trend (statsmodels' det_order -1, 0 and 1) | |
Lagged differenceslagged_differencescount · [1, 12] | count | [1, 12] | Lagged differences in the VECM, k (a VAR of order k + 1); at least one, because statsmodels pairs the differences with the current level when there are none |
Significancesignificanceprobability · [0.01, 0.1] | probability | [0.01, 0.1] | The level the ranks are chosen at: 0.10, 0.05 or 0.01 |
Outputs
ARIMA or seasonal ARIMA (Box and Jenkins) (arima): 17 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Parameter namesparameter_namestext (array) · length max 15; each at most 32 characters | text (array) | length max 15; each at most 32 characters | Parameter names, as statsmodels gives them (ar.L1, sigma2) |
Parametersparametersratio (array) · length max 15; each [-1e+300, 1e+300] | ratio (array) | length max 15; each [-1e+300, 1e+300] | Estimates, in the series' units (sigma2 in its square) |
Standard errorsstandard_errorsratio (array) · length max 15; each [0, 1e+300] | ratio (array) | length max 15; each [0, 1e+300] | Standard errors (outer product of gradients); null if undefined |
T statisticst_statisticsratio (array) · length max 15; each [-1e+300, 1e+300] | ratio (array) | length max 15; each [-1e+300, 1e+300] | Estimate over standard error; null without standard errors |
P valuesp_valuesprobability (array) · length max 15; each [0, 1] | probability (array) | length max 15; each [0, 1] | Two-sided p-values from the normal distribution |
Calculationcalculationtext | text | ARIMA | |
Trendtrendtext | text | The trend fitted | |
Log likelihoodlog_likelihoodratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | Exact Gaussian log-likelihood |
AICaicratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | Akaike criterion, -2 LL + 2k |
BICbicratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | Schwarz criterion, -2 LL + k ln n |
HQIChqicratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | Hannan-Quinn criterion, -2 LL + 2k ln ln n |
Observationsobservationscount · [3, 2000] | count | [3, 2000] | Observations in the series |
Horizonshorizonscount (array) · length max 120; each [1, 120] | count (array) | length max 120; each [1, 120] | Forecast horizons, 1 to horizon periods ahead |
Forecastsforecastsratio (array) · length max 120; each [-1e+300, 1e+300] | ratio (array) | length max 120; each [-1e+300, 1e+300] | Forecast mean each period ahead |
Forecast standard errorsforecast_standard_errorsratio (array) · length max 120; each [0, 1e+300] | ratio (array) | length max 120; each [0, 1e+300] | Standard error of each forecast |
Forecast lowerforecast_lowerratio (array) · length max 120; each [-1e+300, 1e+300] | ratio (array) | length max 120; each [-1e+300, 1e+300] | Lower end of each 1 - alpha forecast interval |
Forecast upperforecast_upperratio (array) · length max 120; each [-1e+300, 1e+300] | ratio (array) | length max 120; each [-1e+300, 1e+300] | Upper end of each 1 - alpha forecast interval |
A vector autoregression (Sims 1980; Lütkepohl 2005) (var): 15 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | A vector autoregression | |
Variablesvariablestext (array) · length max 6; each at most 32 characters | text (array) | length max 6; each at most 32 characters | The variables, in the Cholesky ordering of the responses |
Lagslagscount · [1, 12] | count | [1, 12] | The lag order fitted, p |
Observationsobservationscount · [1, 2000] | count | [1, 2000] | Observations in the fit, n - p |
Coefficient namescoefficient_namestext (array) · length max 74; each at most 36 characters | text (array) | length max 74; each at most 36 characters | Each equation's terms: const, trend, then L1.series and so on |
Coefficientscoefficientsratio (array) (array) · length max 6; each length max 74; each [-1e+300, 1e+300] | ratio (array) (array) | length max 6; each length max 74; each [-1e+300, 1e+300] | One row per equation (variable), one value per term |
Standard errorsstandard_errorsratio (array) (array) · length max 6; each length max 74; each [0, 1e+300] | ratio (array) (array) | length max 6; each length max 74; each [0, 1e+300] | The coefficients' standard errors, row by row |
Residual covarianceresidual_covarianceratio (array) (array) · length max 6; each length max 6; each [-1e+300, 1e+300] | ratio (array) (array) | length max 6; each length max 6; each [-1e+300, 1e+300] | Covariance of the residuals, with n - p - (terms) degrees |
Log likelihoodlog_likelihoodratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | Gaussian log-likelihood |
AICaicratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | ln det(Sigma_ML) + 2 m / n, m the coefficients |
BICbicratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | ln det(Sigma_ML) + m ln n / n |
HQIChqicratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | ln det(Sigma_ML) + 2 m ln ln n / n |
Stablestableflag | flag | Whether every lag-polynomial root lies outside the unit circle | |
Impulse responsesimpulse_responsesratio (array) (array) (array) · length max 61; each length max 6; each length max 6; each [-1e+300, 1e+300] | ratio (array) (array) (array) | length max 61; each length max 6; each length max 6; each [-1e+300, 1e+300] | Orthogonalized responses at horizons 0 to horizon: [h][i][j] is variable i's response to a one-standard-deviation shock j |
Variance decompositionvariance_decompositionprobability (array) (array) (array) · length max 60; each length max 6; each length max 6; each [0, 1] | probability (array) (array) (array) | length max 60; each length max 6; each length max 6; each [0, 1] | Forecast-error variance shares 1 to horizon periods ahead: [h][i][j] is the share of variable i's variance due to shock j |
The Engle-Granger two-step test (engle_granger): 9 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | The Engle-Granger test | |
Coefficient namescoefficient_namestext (array) · length max 8; each at most 32 characters | text (array) | length max 8; each at most 32 characters | The cointegrating regression's terms: const, trend, regressors |
Coefficientscoefficientsratio (array) · length max 8; each [-1e+300, 1e+300] | ratio (array) | length max 8; each [-1e+300, 1e+300] | The cointegrating regression's least-squares coefficients |
Statisticstatisticratio · [-1e+300, 1e+300] | ratio | [-1e+300, 1e+300] | ADF t statistic of the residuals |
P valuep_valueprobability · [0, 1] | probability | [0, 1] | MacKinnon's (1994, 2010) p-value |
Critical levelscritical_levelsratio (array) · length max 3; each [-1e+300, 1e+300] | ratio (array) | length max 3; each [-1e+300, 1e+300] | The levels: 0.01, 0.05, 0.10 |
Critical valuescritical_valuesratio (array) · length max 3; each [-1e+300, 1e+300] | ratio (array) | length max 3; each [-1e+300, 1e+300] | MacKinnon's (2010) critical values at those levels |
Lagslagscount · [0, 24] | count | [0, 24] | ADF lags used |
Observationsobservationscount · [3, 2000] | count | [3, 2000] | Observations |
Johansen's trace and maximum-eigenvalue tests (johansen): 10 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Johansen's tests | |
Variablesvariablestext (array) · length max 6; each at most 32 characters | text (array) | length max 6; each at most 32 characters | The variables, in order |
Eigenvalueseigenvaluesratio (array) · length max 6; each [-1e+300, 1e+300] | ratio (array) | length max 6; each [-1e+300, 1e+300] | The eigenvalues, largest first |
Trace statisticstrace_statisticsratio (array) · length max 6; each [-1e+300, 1e+300] | ratio (array) | length max 6; each [-1e+300, 1e+300] | Trace statistic for each null rank r = 0 to K - 1 |
Trace critical valuestrace_critical_valuesratio (array) (array) · length max 6; each length max 6; each [-1e+300, 1e+300] | ratio (array) (array) | length max 6; each length max 6; each [-1e+300, 1e+300] | Critical values per null rank, at 0.10, 0.05 and 0.01 |
Max eigenvalue statisticsmax_eigenvalue_statisticsratio (array) · length max 6; each [-1e+300, 1e+300] | ratio (array) | length max 6; each [-1e+300, 1e+300] | Maximum-eigenvalue statistic for each null rank r = 0 to K - 1 |
Max eigenvalue critical valuesmax_eigenvalue_critical_valuesratio (array) (array) · length max 6; each length max 6; each [-1e+300, 1e+300] | ratio (array) (array) | length max 6; each length max 6; each [-1e+300, 1e+300] | Critical values per null rank, at 0.10, 0.05 and 0.01 |
Rank tracerank_tracecount · [0, 6] | count | [0, 6] | The rank the trace test selects |
Rank max eigenvaluerank_max_eigenvaluecount · [0, 6] | count | [0, 6] | The rank the maximum-eigenvalue test selects |
Observationsobservationscount · [1, 2000] | count | [1, 2000] | Observations in the test's regressions |
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
Loading the calculator…
Worked example
An AR(1) with coefficient 0.6, simulated for 120 periods.
Example arima_ar1. Inputs:
{
"alpha": 0.05,
"ar": 1,
"calculation": "arima",
"differences": 0,
"horizon": 6,
"ma": 0,
"names": null,
"season": 0,
"seasonal_ar": 0,
"seasonal_differences": 0,
"seasonal_ma": 0,
"series": [
1.2247, 0.2074, 0.8714, 0.4264,
-0.1233, -0.2765, -1.0362,
-1.2923, -1.243, -0.7092,
-1.1691, -1.0015, -0.8078,
-0.2372, -0.8039, -0.3559,
1.1721, 1.105, 1.2769, 1.1132,
0.2288, -0.739, 0.0491, 0.6347,
1.6406, 1.8675, 0.1138, 0.6352,
0.0786, 1.5615, 0.362, 0.6384,
0.3664, 0.6071, 0.1426, 1.292,
2.1096, 1.3283, 2.1208, 0.6254,
0.1047, 1.1576, 0.2747, -1.2851,
-0.1912, 0.6972, -0.28, -1.2978,
-0.5271, -0.3885, 0.3447,
2.2174, 3.4599, 2.5341, 1.7225,
0.8681, 0.0533, 0.3407, -0.2434,
0.242, -1.1835, -1.4444,
-0.5755, -1.1911, -1.8822,
0.6603, 0.9398, 1.561, 1.8857,
1.0047, 1.3946, 1.202, 0.2056,
-0.0007, 0.1912, -1.3597,
0.0098, 1.0977, 0.8085, 0.7873,
-1.0044, -0.9553, -0.9898,
0.1193, 0.8114, -0.1331, 0.2891,
-1.0763, -1.8394, -2.2705,
-3.2651, -1.3233, -0.324,
-0.0458, -1.0846, -0.3155,
-0.6709, -0.1265, -0.5889,
-0.7243, -0.0371, 0.3154,
-1.6225, -1.0119, -0.4327,
-1.1634, 0.1461, 0.2991,
-2.6027, -0.9394, 0.3676,
0.1803, 0.6426, 0.5776, -0.2194,
0.8852, 1.5771, -1.5285, 0.6926,
-0.7461
],
"trend": null
}Outputs:
{
"aic": 317.4693646935062,
"bic": 325.8318399218523,
"calculation": "arima",
"forecast_lower": [
-2.154413664770054,
-2.2485017555290336,
-2.225998046277747,
-2.1886445886908836,
-2.1580476509968776,
-2.1367592238959117
],
"forecast_standard_errors": [
0.8842377792470786,
1.0319308024436478,
1.080424171378848,
1.0974485910857992,
1.103545945215741,
1.1057446306864083
],
"forecast_upper": [
1.3117347374178516,
1.7965926591251011,
2.009186881580399,
2.113274838133899,
2.1677729648192505,
2.1976800805918946
],
"forecasts": [
-0.4213394636761012,
-0.22595454820196628,
-0.10840558234867406,
-0.03768487527849257,
0.004862656911186328,
0.030460428347991578
],
"horizons": [1, 2, 3, 4, 5, 6],
"hqic": 320.86540447206625,
"log_likelihood": -155.7346823467531,
"observations": 120,
"p_values": [
0.736811783414159,
8.491138838318668e-18,
2.403521451230432e-16
],
"parameter_names": ["const", "ar.L1", "sigma2"],
"parameters": [
0.06911854937308229,
0.6016276413562407,
0.7818764502478053
],
"standard_errors": [
0.20566201065756964,
0.07001571892823151,
0.09535058374044919
],
"t_statistics": [
0.3360783508441222,
8.592751035991354,
8.200017446942185
],
"trend": "c"
}Assumptions
- ARIMA: statsmodels' state-space ARIMA, exact Gaussian maximum likelihood with stationarity and invertibility enforced; standard errors from the outer product of gradients (statsmodels' default), p-values normal; intervals assume normal errors and ignore parameter uncertainty.
- VAR: least squares equation by equation; lag order chosen by AIC, BIC or Hannan-Quinn over 1 to max_lags on a common sample, then refitted on all the data. The criteria count every coefficient, m = K^2 p plus K per deterministic term (Lütkepohl's book counts K^2 p alone: the same order is chosen). Impulse responses are orthogonalized by the Cholesky factor of the residual covariance in the order series, second, ..., sixth: a shock to an earlier variable moves later ones at once, not the reverse.
- Engle-Granger: the cointegrating regression of series on the other variables and the trend terms by least squares, then an ADF test without deterministic terms on its residuals; statsmodels' coint gives MacKinnon's p-value and critical values at T = n - 1.
- Johansen: statsmodels' coint_johansen (the LeSage implementation), the deterministic terms detrending the levels before the reduced-rank regression; critical values from MacKinnon, Haug and Michelis' johdist at 0.10, 0.05 and 0.01; the rank is the first null not rejected at the chosen level. At least one lagged difference is required: with none, coint_johansen regresses the differences on the current level rather than the lagged one (issue #156).
- Profiles: default binds 240 months of US CPI inflation (us.inflation.cpi.yoy) to series and the unemployment rate (us.unemployment.rate) to second, for every calculation (arima reads series alone). concepts= rebinds either to any other monthly rate or ratio series in the catalog.
Limitations
- A variable that does not vary, collinear variables (a singular covariance, an exact cointegrating fit, a degenerate eigenproblem) or an output that is not finite raise DomainError.
- The ARIMA optimizer may stop short of the maximum, or the observed information may be singular: a warning says so, and standard errors are then null. A VAR whose lag polynomial has a root on or inside the unit circle is reported with a warning; its responses do not die out.
- BLS published no October 2025 CPI or unemployment rate (the federal shutdown), and a binding never fills a gap: the default profile's window cannot span that month, so bind it as of 2025-09-30 or earlier, or rebind to series without the gap.
- Cointegration tests have low power in short samples; the critical values are asymptotic (Johansen) or response surfaces in the sample size (Engle-Granger), and neither corrects for lag selection.
- Needs the econometrics extra: pip install 'pyeconomics[econometrics]'.
Evidence
Status: standard. Textbook consensus, such as bond duration or the CAPM formula.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Data
This model can read its data for you: each bound field names a data series, and the sources listed can fill it, in the order they are tried. This website reads only the sources whose terms let it serve their data (marked "hosted"); every source is available when you run pyeconomics on your own computer.
| Field | Concept | Read as | Sources (licence class; hosted) |
|---|---|---|---|
series | CPI inflation, year over yearus.inflation.cpi.yoy | the last 240 observations on or before the date; real time: as published by the date |
|
second | Unemployment rateus.unemployment.rate | the last 240 observations on or before the date; real time: as published by the date |
|
Citations
- Box, G. E. P., Jenkins, G. M., Reinsel, G. C. and Ljung, G. M. (2015). Time Series Analysis: Forecasting and Control, 5th ed. Wiley. https://www.wiley.com/en-us/Time+Series+Analysis%3A+Forecasting+and+Control%2C+5th+Edition-p-9781118675021 (Chapters 4, 7 and 9: ARIMA models, their estimation and seasonal models)
- Lütkepohl, H. (2005). New Introduction to Multiple Time Series Analysis. Springer. doi:10.1007/978-3-540-27752-1 (Sections 3.2 (least squares), 2.3.2 and 2.3.3 (orthogonalized impulse responses, forecast-error variance decomposition) and 4.3 (lag criteria))
- Sims, C. A. (1980). Macroeconomics and reality. Econometrica, 48(1), 1-48. doi:10.2307/1912017 (Section 5: innovation accounting with a triangular orthogonalization)
- Hannan, E. J. and Quinn, B. G. (1979). The determination of the order of an autoregression. Journal of the Royal Statistical Society: Series B, 41(2), 190-195. doi:10.1111/j.2517-6161.1979.tb01072.x (The criterion with penalty 2 k ln ln n)
- Engle, R. F. and Granger, C. W. J. (1987). Co-integration and error correction: Representation, estimation, and testing. Econometrica, 55(2), 251-276. doi:10.2307/1913236 (Section 5: the two-step test on the cointegrating regression)
- MacKinnon, J. G. (1994). Approximate asymptotic distribution functions for unit-root and cointegration tests. Journal of Business & Economic Statistics, 12(2), 167-176. doi:10.1080/07350015.1994.10510005 (The response surfaces for p-values)
- MacKinnon, J. G. (2010). Critical values for cointegration tests. Queen's Economics Department Working Paper No. 1227. https://www.econ.queensu.ca/sites/econ.queensu.ca/files/wpaper/qed_wp_1227.pdf (Table 2: response-surface coefficients of the tau critical values)
- Johansen, S. (1991). Estimation and hypothesis testing of cointegration vectors in Gaussian vector autoregressive models. Econometrica, 59(6), 1551-1580. doi:10.2307/2938278 (The trace and maximum-eigenvalue likelihood-ratio statistics)
- MacKinnon, J. G., Haug, A. A. and Michelis, L. (1999). Numerical distribution functions of likelihood ratio tests for cointegration. Journal of Applied Econometrics, 14(5), 563-577. doi:10.1002/(SICI)1099-1255(199909/10)14:5<563::AID-JAE530>3.0.CO;2-R (The critical values of the trace and maximum-eigenvalue tests)
- Seabold, S. and Perktold, J. (2010). statsmodels: Econometric and statistical modeling with Python. Proceedings of the 9th Python in Science Conference, 92-96. doi:10.25080/Majora-92bf1922-011 (statsmodels.tsa: ARIMA, VAR, stattools.coint, stattools.adfuller and vector_ar.vecm.coint_johansen)
Changelog
- Version 1: First version.
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/econometrics.time_series/run- MCP tool
run_modelwith the model's id,econometrics.time_series. Connect an assistant- Command line
pyeconomics models run econometrics.time_series --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"alpha": 0.05,
"ar": 1,
"calculation": "arima",
"differences": 0,
"horizon": 6,
"ma": 0,
"names": None,
"season": 0,
"seasonal_ar": 0,
"seasonal_differences": 0,
"seasonal_ma": 0,
"series": [
1.2247, 0.2074, 0.8714,
0.4264, -0.1233, -0.2765,
-1.0362, -1.2923, -1.243,
-0.7092, -1.1691, -1.0015,
-0.8078, -0.2372, -0.8039,
-0.3559, 1.1721, 1.105,
1.2769, 1.1132, 0.2288,
-0.739, 0.0491, 0.6347,
1.6406, 1.8675, 0.1138,
0.6352, 0.0786, 1.5615,
0.362, 0.6384, 0.3664,
0.6071, 0.1426, 1.292,
2.1096, 1.3283, 2.1208,
0.6254, 0.1047, 1.1576,
0.2747, -1.2851, -0.1912,
0.6972, -0.28, -1.2978,
-0.5271, -0.3885, 0.3447,
2.2174, 3.4599, 2.5341,
1.7225, 0.8681, 0.0533,
0.3407, -0.2434, 0.242,
-1.1835, -1.4444, -0.5755,
-1.1911, -1.8822, 0.6603,
0.9398, 1.561, 1.8857,
1.0047, 1.3946, 1.202,
0.2056, -0.0007, 0.1912,
-1.3597, 0.0098, 1.0977,
0.8085, 0.7873, -1.0044,
-0.9553, -0.9898, 0.1193,
0.8114, -0.1331, 0.2891,
-1.0763, -1.8394, -2.2705,
-3.2651, -1.3233, -0.324,
-0.0458, -1.0846, -0.3155,
-0.6709, -0.1265, -0.5889,
-0.7243, -0.0371, 0.3154,
-1.6225, -1.0119, -0.4327,
-1.1634, 0.1461, 0.2991,
-2.6027, -0.9394, 0.3676,
0.1803, 0.6426, 0.5776,
-0.2194, 0.8852, 1.5771,
-1.5285, 0.6926, -0.7461,
],
"trend": None,
}
result = pyeconomics.run("econometrics.time_series", inputs)
print(result.to_json())
pyeconomics models run econometrics.time_series --inputs - <<'JSON'
{
"alpha": 0.05,
"ar": 1,
"calculation": "arima",
"differences": 0,
"horizon": 6,
"ma": 0,
"names": null,
"season": 0,
"seasonal_ar": 0,
"seasonal_differences": 0,
"seasonal_ma": 0,
"series": [
1.2247, 0.2074, 0.8714, 0.4264,
-0.1233, -0.2765, -1.0362,
-1.2923, -1.243, -0.7092,
-1.1691, -1.0015, -0.8078,
-0.2372, -0.8039, -0.3559,
1.1721, 1.105, 1.2769, 1.1132,
0.2288, -0.739, 0.0491, 0.6347,
1.6406, 1.8675, 0.1138, 0.6352,
0.0786, 1.5615, 0.362, 0.6384,
0.3664, 0.6071, 0.1426, 1.292,
2.1096, 1.3283, 2.1208, 0.6254,
0.1047, 1.1576, 0.2747, -1.2851,
-0.1912, 0.6972, -0.28, -1.2978,
-0.5271, -0.3885, 0.3447,
2.2174, 3.4599, 2.5341, 1.7225,
0.8681, 0.0533, 0.3407, -0.2434,
0.242, -1.1835, -1.4444,
-0.5755, -1.1911, -1.8822,
0.6603, 0.9398, 1.561, 1.8857,
1.0047, 1.3946, 1.202, 0.2056,
-0.0007, 0.1912, -1.3597,
0.0098, 1.0977, 0.8085, 0.7873,
-1.0044, -0.9553, -0.9898,
0.1193, 0.8114, -0.1331, 0.2891,
-1.0763, -1.8394, -2.2705,
-3.2651, -1.3233, -0.324,
-0.0458, -1.0846, -0.3155,
-0.6709, -0.1265, -0.5889,
-0.7243, -0.0371, 0.3154,
-1.6225, -1.0119, -0.4327,
-1.1634, 0.1461, 0.2991,
-2.6027, -0.9394, 0.3676,
0.1803, 0.6426, 0.5776, -0.2194,
0.8852, 1.5771, -1.5285, 0.6926,
-0.7461
],
"trend": null
}
JSON