Implements the Power / Trend / Seasonal (PTS) model, a unified
state-space framework based on the Multiple Source of Error (MSOE) model. It brings
the trend, seasonal and irregular component models of Harvey (1989)
muse is an R package implementing the PTS (Power / Trend / Seasonal) state-space family of models for time-series analysis and for forecasting. The estimation engine is written in C++ (Rcpp & RcppArmadillo), wrapping a Kalman filter/smoother around a Multiple Source of Error (MSOE) model whose components are selected analogously to the ETS taxonomy.
The package shares conventions with smooth and greybox: the returned object inherits from c("pts", "smooth") so generics such as forecast(), accuracy(), plot(), AIC(), and BIC() work out of the box.
The package is not yet on CRAN. Install the development version directly from GitHub:
# install.packages("remotes")
remotes::install_github("openforecast-org/muse")
Once released on CRAN:
install.packages("muse")
The user-facing entry point is pts(). In a single call it can:
"PTS" —
Power / Trend / Seasonal in that order (e.g. "ZZZ", "0LT", "0.5GD")
P — power (Box-Cox λ): a numeric value or "Z" to estimate it jointly with the state-space parameters.T — trend: N none, L local, D damped, G global, or Z for automatic selection.S — seasonal: N none, D discrete, T trigonometric (harmonic seasonality), or Z for automatic selection.select = TRUE or Z letters in the model string).arma = c(p, q) or a list).outliers = "use" with a user-supplied confidence level (e.g. 0.99). Detected outliers are reported in the fitted object and added as dummy regressors.data argument (a data.frame / ts / matrix whose first column is the response).forecast().simulate() (in-sample replay from the initial state, forward simulation for forecasts).holdout = TRUE plus h = ....The full method list includes print, summary, plot, coef, vcov, confint, sigma, nobs, nparam, logLik, AIC, BIC, fitted, residuals, rstandard, rstudent, pointLik, accuracy, actuals, modelType, lags, orders, errorType, outlierdummy, and update.
library(muse)
# Fit a model with automatic Box-Cox, trend, seasonal,
# holding out the last 12 observations and forecasting them back.
model <- pts(AirPassengers, model = "ZZZ", h = 12,
holdout = TRUE, ic = "AICc")
summary(model)
plot(forecast(model, h = 12))
# With engine-side outlier detection at the 99% confidence level
model_out <- pts(AirPassengers, model = "ZZZ", h = 12,
outliers = "use", level = 0.99)
model_out$outliersDetected
Bug reports and feature requests are welcome at the issue tracker.
Parts of the C++ engine refactoring and the Python translation of the package were developed with the assistance of Anthropic's Claude. Responsibility for the code and its correctness rests with the package authors.
muse is developed and maintained by OpenForecast, a demand forecasting and inventory management consultancy. The package implements the methods we use in our consulting and teach in our training courses.