Repository navigation
Installation
Ivan Svetunkov edited this page Oct 22, 2026
·
9 revisions
install.packages("greybox")
library(greybox)remotes::install_github("openforecast-org/greybox")Building from source compiles C++ code through Rcpp, so it needs the R build tools (Rtools on Windows, the Xcode command-line tools on macOS).
- R 3.5.0 or higher.
- Imports, installed automatically:
stats,generics(>= 0.1.2),graphics,utils,pracma,nloptr,statmod,zoo,texreg,xtable,methods,Rcpp(alsoLinkingTo). - Suggested:
smooth(>= 3.1.0), used byxregExpander()andB()to extrapolate the lags and leads (without it, the gaps take the first and last values);foreachwithdoMCordoParallelforparallel=TRUEincalm()andro().
packageVersion("greybox")
model <- alm(mpg ~ wt + disp + hp, mtcars, distribution="dnorm")
summary(model)pip install greyboxpip install "git+https://github.com/openforecast-org/greybox.git#subdirectory=python"or, for an editable install:
git clone https://github.com/openforecast-org/greybox.git
cd greybox/python
pip install -e .Installing from source compiles five C++ extensions with pybind11 (the densities, dgamma, lowess, supsmu and the latent variance of ALM), so it needs a C++17 compiler; pybind11 is fetched automatically as a build requirement. The wheels on PyPI need no compiler.
| Package | Minimum version |
|---|---|
| Python | 3.11 |
| numpy | 1.20.0 |
| scipy | 1.7.0 |
| pandas | 1.3.0 |
| nlopt | 2.7.0 |
| matplotlib | 3.5 |
Optional: smooth (Python), used by xreg_expander() and B() to extrapolate the lags and leads, as in R; without it they fill the gaps with the first and last values. The development tools are in the dev extra: pip install "greybox[dev]".
from importlib.metadata import version
from greybox import ALM, formula, mtcars
print(version("greybox"))
y, X = formula("mpg ~ wt + disp + hp", mtcars)
model = ALM(distribution="dnorm").fit(X, y)
print(model.summary())-
A compiler error during
pip installmeans pip is building from source: either no wheel matches the platform and Python version, or the install is from GitHub. Install a C++17 compiler (build-essentialon Debian/Ubuntu, the Xcode command-line tools on macOS, the MSVC build tools on Windows), or use a Python version with a published wheel. -
nloptfails to install:nloptships wheels for the common platforms;pip install --no-cache-dir nloptretries without a stale cached build.
- Home — function index and quick start
- ALM — the core estimator
- R-Python-differences — how closely the two implementations agree