Chapter 17 Other related packages
Packages that will do Kalman filtering and smoothing are many, but packages that estimate the parameters in a MARSS model, especially constrained MARSS models, are much less common. The following are those with which we are familiar, however there are certainly more packages for estimating MARSS models in engineering and economics of which we are unfamiliar. The MARSS package is unusual in that it uses an EM algorithm for maximizing the likelihood as opposed to a Newton-esque method (e.g. BFGS). The package is also unusual in that it allows you to specify the initial conditions at \(t=0\) or \(t=1\), allows degenerate models (with some of the diagonal elements of \(\mathbf{R}\) or \(\mathbf{Q}\) equal to zero). Lastly, model specification in the MARSS package has a one-to-one relationship between the model list in MARSS()
and the model as you would write it on paper as a matrix equation. This makes the learning curve a bit less steep. However, the MARSS package has not been optimized for speed and probably will be really slow if you have time-series data with a lot of time points.
- atsar is an R package we wrote for fitting MARSS models using STAN. It allows fast and flexible fitting of MARSS models in a Bayesian framework. Our book from our time-series class has example applications Applied Time-Series Analysis for Fisheries and Environmental Sciences.
- The stats package (part of base R) has functions for fitting univariate structural time series models (MARSS models with a univariate \(y\)). Read the help file at
?StructTS
. The Kalman filter and smoother functions are described here:?KalmanLike
. - DLM is an R package for fitting MARSS models. It is mainly Bayesian focused but it does allow MLE estimation via the
optim()
function. It has a book, Dynamic Linear Models with R by Petris et al., which has many examples of how to write MARSS models for different applications. - sspir an R package for fitting ARSS (univariate) models with Gaussian, Poisson and binomial error distributions.
- dse (Dynamic Systems Estimation) is an R package for multivariate Gaussian state-space models with a focus on ARMA models.
- SsfPack is a package for Ox/Splus that fits constrained multivariate Gaussian state-space models using mainly (it seems) the BFGS algorithm but the newer versions support other types of maximization. SsfPack is very flexible and written in C to be fast. It has been used extensively on statistical finance problems and is optimized for dealing with large (financial) data sets. It is used and documented in Time Series Analysis by State Space Methods by Durbin and Koopman, An Introduction to State Space Time Series Analysis by Commandeur and Koopman, and Statistical Algorithms for Models in State Space Form: SsfPack 3.0, by Koopman, Shephard, and Doornik.
- The Brodgar software was developed by Alain Zuur to do (among many other things) dynamic factor analysis, which involves a special type of MARSS model. The methods and many example analyses are given in Analyzing Ecological Data by Zuur, Ieno and Smith. This is the one package that we are aware of that also uses an EM algorithm for parameter estimation.
- eViews is commercial economics software that will estimate at least some types of MARSS models.
- KFAS R package provides a fast Kalman filter and smoother. Examples in the package show how to estimate MARSS models using the KFAS functions and R’s
optim()
function. The MARSS package uses the filter and smoother functions from the KFAS package. - S+FinMetrics is a S-plus module for fitting MAR models, which are called vector autoregressive (VAR) models in the economics and finance literature. It has some support for state-space VAR models, though we haven’t used it so are not sure which parameters it allows you to estimate. It was developed by Andrew Bruce, Doug Martin, Jiahui Wang, and Eric Zivot, and it has a book associated with it: Modeling Financial Time Series with S-plus by Eric Zivot and Jiahui Wang.
- kftrack is an R package provides a suite of functions specialized for fitting MARSS models to animal tracking data.
- crawl is an R package provides for fitting MARSS models to animal tracking data with covariates.