100% FreeNo Signup Required

statsmodels Import Reference

Which import paths actually work, captured by executing every statement on statsmodels 0.14.6 / Python 3.12.10 — not transcribed from documentation.

If you are here from a traceback

from statsmodels.tsa.arima.model import ARIMA
from statsmodels.tsa.vector_ar.vecm import coint_johansen

Capital ARIMA. Lowercase arima is a module, not the class, which is why your import line succeeded and the error appeared somewhere else entirely.

The imports that succeed and then fail

This is the part no documentation-derived reference contains, because you cannot see it without running the code. Three of these four statements import cleanly. They hand back different objects, and the failure surfaces later — at the call, or at instantiation — by which point the import line looks innocent.

StatementImportsWhat you getFails when
from statsmodels.tsa.arima.model import ARIMAyestype statsmodels.tsa.arima.model.ARIMAnever — this one works
from statsmodels.tsa.api import ARIMAyestype statsmodels.tsa.arima.model.ARIMAnever — this one works
from statsmodels.tsa.api import arimayesmoduleon call: TypeError: 'module' object is not callable
from statsmodels.tsa.arima_model import ARIMAyestype statsmodels.tsa.arima_model.ARIMAon instantiate: NotImplementedError: statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the . between arima and model) and statsmodels.tsa.SARIMAX. statsmodels.tsa.arima.model.ARIMA makes use of the statespa

Every path, executed

Both the statements that work and the ones that do not. Failing paths are kept with their real exception text so you can match the traceback in front of you — a reference that lists only what works cannot be searched from an error message.

StatementResult
from statsmodels.tsa.api import ARIMAtype · statsmodels.tsa.arima.model.ARIMA
from statsmodels.tsa.arima.model import ARIMAtype · statsmodels.tsa.arima.model.ARIMA
from statsmodels.tsa.arima_model import ARIMAtype · statsmodels.tsa.arima_model.ARIMA
from statsmodels.tsa.statespace.sarimax import SARIMAXtype · statsmodels.tsa.statespace.sarimax.SARIMAX
from statsmodels.tsa.api import SARIMAXtype · statsmodels.tsa.statespace.sarimax.SARIMAX
from statsmodels.tsa.vector_ar.vecm import coint_johansenfunction · statsmodels.tsa.vector_ar.vecm.coint_johansen
from statsmodels.tsa.johansen import coint_johansenModuleNotFoundError: No module named 'statsmodels.tsa.johansen'
from statsmodels.tsa.api import coint_johansenImportError: cannot import name 'coint_johansen' from 'statsmodels.tsa.api'
from statsmodels.tsa.stattools import cointfunction · statsmodels.tsa.stattools.coint
from statsmodels.tsa.stattools import adfullerfunction · statsmodels.tsa.stattools.adfuller
from statsmodels.tsa.stattools import kpssfunction · statsmodels.tsa.stattools.kpss
from statsmodels.tsa.stattools import acffunction · statsmodels.tsa.stattools.acf
from statsmodels.tsa.stattools import grangercausalitytestsfunction · statsmodels.tsa.stattools.grangercausalitytests
from statsmodels.tsa.vector_ar.vecm import VECMtype · statsmodels.tsa.vector_ar.vecm.VECM
from statsmodels.tsa.api import VARtype · statsmodels.tsa.vector_ar.var_model.VAR
from statsmodels.tsa.seasonal import seasonal_decomposefunction · statsmodels.tsa.seasonal.seasonal_decompose
from statsmodels.tsa.seasonal import STLtype · statsmodels.tsa.stl._stl.STL
from statsmodels.api import OLStype · statsmodels.regression.linear_model.OLS
from statsmodels.api import add_constantfunction · statsmodels.tools.tools.add_constant
from statsmodels.stats.diagnostic import het_breuschpaganfunction · statsmodels.stats.diagnostic.het_breuschpagan
from statsmodels.stats.diagnostic import acorr_ljungboxfunction · statsmodels.stats.diagnostic.acorr_ljungbox
from statsmodels.stats.outliers_influence import variance_inflation_factorfunction · statsmodels.stats.outliers_influence.variance_inflation_factor
from statsmodels.tsa.holtwinters import ExponentialSmoothingtype · statsmodels.tsa.holtwinters.model.ExponentialSmoothing
from statsmodels.stats.multitest import multipletestsfunction · statsmodels.stats.multitest.multipletests

What coint_johansen actually returns

Run on 1,000 real daily closes for AAPL and MSFT (2022-08-24 to 2026-08-19), via coint_johansen(data, det_order=0, k_ar_diff=1). The attribute names below are the ones the returned object really carries, listed with dir().

Trace test — lr1 vs cvt

Nulllr190%95%99%
r ≤ 05.853813.4315.4919.93
r ≤ 10.54452.713.846.63

Every statistic here is below its 95% critical value, so this pair shows no evidence of cointegration over this window. That is the honest result for two large-cap equities, and it is shown rather than a hand-picked pair that works.

Attributes on the returned object

cvm, cvt, eig, evec, ind, lr1, lr2, max_eig_stat, max_eig_stat_crit_vals, meth, r0t, rkt, trace_stat, trace_stat_crit_vals

Returned type: JohansenTestResult. Note what is absent: there is no p-value attribute, and no summary().

How to read it

lr1 holds the TRACE statistic for r=0, r<=1, ... and cvt the matching critical values at 90/95/99%. Reject the null of at most r cointegrating relations when lr1[r] exceeds cvt[r][1] for the 95% level. lr2/cvm are the maximum-eigenvalue form of the same test. There are no p-values -- only these critical values, which is the single most common source of confusion with this function.

from statsmodels.tsa.vector_ar.vecm import coint_johansen

# data: an (n_obs, n_series) array of LEVELS, not returns
res = coint_johansen(data, det_order=0, k_ar_diff=1)

# Trace test at the 95% level (column index 1 of the critical-value table)
for r in range(len(res.lr1)):
    reject = res.lr1[r] > res.cvt[r, 1]
    print(f"r <= {r}:  trace={res.lr1[r]:.4f}  crit95={res.cvt[r, 1]:.4f}  reject={reject}")

# The cointegrating vector, if you rejected r = 0
beta = res.evec[:, 0]

Method

Each import statement was executed in this interpreter and its outcome recorded. Failing paths are kept with their real exception text so a reader can match the traceback they are looking at. Return shapes come from calling the function on real daily price data, not from documentation.

This matters because import paths move between releases and documentation lags them. Anything on this page can be regenerated with python -m pipeline.statsmodels_imports, and every figure is tagged with the version that produced it — so when it goes stale, it goes visibly stale rather than quietly wrong.

Frequently asked questions

Why does 'from statsmodels.tsa.api import arima' give "module object is not callable"?+

Because lowercase `arima` is a MODULE (statsmodels.tsa.arima.api) and uppercase `ARIMA` is the class. The import line succeeds either way, so the traceback appears further down at the point you call it, where nothing looks wrong. Use `from statsmodels.tsa.arima.model import ARIMA` — capital ARIMA. Measured on statsmodels 0.14.6.

Is statsmodels.tsa.api the wrong place to import ARIMA from?+

No, and this is widely misreported. `from statsmodels.tsa.api import ARIMA` works and returns the same class as the canonical path — it was executed here to confirm it. The path that is genuinely dead is `statsmodels.tsa.arima_model`, which imports a removal shim that raises NotImplementedError the moment you instantiate it.

Where is coint_johansen imported from?+

From `statsmodels.tsa.vector_ar.vecm`. The two paths people commonly try — `statsmodels.tsa.johansen` and `statsmodels.tsa.api` — both fail, and their exact errors are in the table on this page so you can match the traceback you are looking at.

How do I read what coint_johansen returns?+

lr1 holds the TRACE statistic for r=0, r<=1, ... and cvt the matching critical values at 90/95/99%. Reject the null of at most r cointegrating relations when lr1[r] exceeds cvt[r][1] for the 95% level. lr2/cvm are the maximum-eigenvalue form of the same test. There are no p-values -- only these critical values, which is the single most common source of confusion with this function.

Does coint_johansen give p-values?+

No. It returns test statistics (`lr1` for trace, `lr2` for maximum eigenvalue) and matching critical-value tables (`cvt`, `cvm`) at the 90%, 95% and 99% levels. You compare the statistic against the column you want. Expecting a p-value attribute is the single most common source of confusion with this function.

Related

Measured on statsmodels 0.14.6, Python 3.12.10, generated 2026-08-20T16:00:27+00:00. statsmodels is BSD-licensed open-source software; this page is not affiliated with the statsmodels project.