Limitations and Customization

Vladimír Holý

2025-08-18

Adding a New Distribution

Despite providing a reasonable range of distributions, the current version of the package does not include certain distributions found in the GAS literature. Notable examples are copula models (De Lira Salvatierra and Patton 2015; Koopman et al. 2018), matrix models (Hansen, Janus, and Koopman 2016; Opschoor et al. 2018), and censoring models (Harvey and Ito 2020; Harvey and Liao 2023).

Users are encouraged to customize the package by adding new distributions. To incorporate a new distribution into the package, please follow these steps:

  1. Choose a name for the distribution and parametrization, such as newdistr and newparam, respectively.

  2. Create an R file in the R directory, such as R/distr_newdist_newparam.R, which will contain all the necessary functions for the new distribution.

  3. Implement the following functions in the R file, adhering to the structure used for other distributions in the package:

    • distr_newdistr_newparam_parameters() listing the parameters,
    • distr_newdistr_newparam_density() computing the density,
    • distr_newdistr_newparam_loglik() computing the log-likelihood,
    • distr_newdistr_newparam_mean() computing the mean,
    • distr_newdistr_newparam_var() computing the variance,
    • distr_newdistr_newparam_score() computing the score,
    • distr_newdistr_newparam_fisher() computing the Fisher information,
    • distr_newdistr_newparam_random() generating random variables,
    • distr_newdistr_newparam_start() estimating starting values of the parameters.
  4. Update the distr_table.xlsx file located in the data-raw directory by adding a new row to the table that includes the names of the distribution and parametrization.

  5. Run the distr_table.R script located in the data-raw directory. This script saves the content of the distr_table.xlsx table to the distr_table dataset in the package.

By following these steps, users will be able to add a novel distribution to the package, integrating it with the existing framework.

Interaction Between Parameters and Non-Linear Dependence

The dynamics are implemented in the standard form of Creal, Koopman, and Lucas (2013), which has been further extended to include exogenous variables. However, it is worth noting that existing literature includes models with interactions between different time-varying parameters or nonlinear forms of dependence on past values (Harvey and Sucarrat 2014; Holý and Tomanová 2022). Incorporating such complex dynamics would significantly complicate the interface of the functions, so we have opted to keep the dynamics simple for ease of use.

Nevertheless, the source code can be modified to accommodate specific cases. This can be achieved by using a placeholder exogenous variable and making a manual adjustment within the likelihood_evaluate() function in the helper_likelihood.R file. Specifically, the value of the placeholder variable can be can hard-coded to a desirable transformation of any concurrent or lagged parameter.

Non-Standard Structure of Time Series

The package focuses on the standard form of time series. However, certain applications, such as those in the field of sports statistics, may require a specialized structure for modeling time series data. In these cases, the individual matches between teams or players in a specific league are often modeled using distributions like Bernoulli, Skellam, or bivariate Poisson (Gorgi, Koopman, and Lit 2019; Koopman and Lit 2019). Time series should therefore represent the outcomes of matches. However, at each observation, different teams may be participating. This unique characteristic cannot be adequately captured by the standard form of univariate (or bivariate) time series, and a more sophisticated data structure is required to account for the varying teams involved.

To address this limitation, an R package that specifically caters to the use of score-driven models in sports statistics is currently being developed. This specialized package will provide the necessary tools and data structures to effectively model and analyze the unique dynamics present in these applications. However, there are other options beyond R that already exist. Notably, GAS pairwise comparison models can be estimated using the PyFlux package in Python (Taylor 2018), as well as through the stand-alone GUI application Time Series Lab (Lit, Koopman, and Harvey 2021).

Other Dynamic Models Using Score

In the literature on GAS models, the score has been employed in a wide range of dynamic models. Some of these models fall outside the scope of this package. Examples of such models include semiparametric models (Blasques, Ji, and Lucas 2016; Patton, Ziegel, and Chen 2019), Markov regime switching models (Bazzi et al. 2017; Blazsek and Haddad 2023), and spatio-temporal models (Catania and Billé 2017; Gasperoni et al. 2023).

References

Bazzi, Marco, Francisco Blasques, Siem Jan Koopman, and Andre Lucas. 2017. “Time-Varying Transition Probabilities for Markov Regime Switching Models.” Journal of Time Series Analysis 38 (3): 458–78. https://doi.org/10.1111/jtsa.12211.
Blasques, Francisco, Jiangyu Ji, and André Lucas. 2016. “Semiparametric Score Driven Volatility Models.” Computational Statistics & Data Analysis 100 (2013): 58–69. https://doi.org/10.1016/j.csda.2015.04.003.
Blazsek, Szabolcs, and Michel Ferreira Cardia Haddad. 2023. “Score-Driven Multi-Regime Markov-Switching EGARCH: Empirical Evidence Using the Meixner Distribution.” Studies in Nonlinear Dynamics and Econometrics 27 (4): 589–634. https://doi.org/10.1515/snde-2021-0101.
Catania, Leopoldo, and Anna Gloria Billé. 2017. “Dynamic Spatial Autoregressive Models with Autoregressive and Heteroskedastic Disturbances.” Journal of Applied Econometrics 32 (6): 1178–96. https://doi.org/10.1002/jae.2565.
Creal, Drew, Siem Jan Koopman, and André Lucas. 2013. “Generalized Autoregressive Score Models with Applications.” Journal of Applied Econometrics 28 (5): 777–95. https://doi.org/10.1002/jae.1279.
De Lira Salvatierra, Irving, and Andrew J. Patton. 2015. “Dynamic Copula Models and High Frequency Data.” Journal of Empirical Finance 30: 120–35. https://doi.org/10.1016/j.jempfin.2014.11.008.
Gasperoni, Francesca, Alessandra Luati, Lucia Paci, and Enzo D’Innocenzo. 2023. “Score-Driven Modeling of Spatio-Temporal Data.” Journal of the American Statistical Association 118 (542): 1066–77. https://doi.org/10.1080/01621459.2021.1970571.
Gorgi, P., Siem Jan Koopman, and Rutger Lit. 2019. “The Analysis and Forecasting of Tennis Matches by Using a High Dimensional Dynamic Model.” Journal of the Royal Statistical Society: Series A (Statistics in Society) 182 (4): 1393–1409. https://doi.org/10.1111/rssa.12464.
Hansen, Peter Reinhard, Pawel Janus, and Siem Jan Koopman. 2016. “Realized Wishart-GARCH: A Score-Driven Multi-Asset Volatility Model.” https://doi.org/10.2139/ssrn.2821497.
Harvey, Andrew C., and Ryoko Ito. 2020. “Modeling Time Series When Some Observations Are Zero.” Journal of Econometrics 214 (1): 33–45. https://doi.org/10.1016/j.jeconom.2019.05.003.
Harvey, Andrew C., and Yin Liao. 2023. “Dynamic Tobit Models.” Econometrics and Statistics 26: 72–83. https://doi.org/10.1016/j.ecosta.2021.08.012.
Harvey, Andrew C., and Genaro Sucarrat. 2014. “EGARCH Models with Fat Tails, Skewness and Leverage.” Computational Statistics & Data Analysis 76: 320–38. https://doi.org/10.1016/j.csda.2013.09.022.
Holý, Vladimír, and Petra Tomanová. 2022. “Modeling Price Clustering in High-Frequency Prices.” Quantitative Finance 22 (9): 1649–63. https://doi.org/10.1080/14697688.2022.2050285.
Koopman, Siem Jan, and Rutger Lit. 2019. “Forecasting Football Match Results in National League Competitions Using Score-Driven Time Series Models.” International Journal of Forecasting 35 (2): 797–809. https://doi.org/10.1016/j.ijforecast.2018.10.011.
Koopman, Siem Jan, Rutger Lit, André Lucas, and Anne Opschoor. 2018. “Dynamic Discrete Copula Models for High-Frequency Stock Price Changes.” Journal of Applied Econometrics 33 (7): 966–85. https://doi.org/10.1002/jae.2645.
Lit, Rutger, Siem Jan Koopman, and Andrew C. Harvey. 2021. Time Series Lab - Score Edition. https://timeserieslab.com.
Opschoor, Anne, Pawel Janus, André Lucas, and Dick van Dijk. 2018. “New HEAVY Models for Fat-Tailed Realized Covariances and Returns.” Journal of Business & Economic Statistics 36 (4): 643–57. https://doi.org/10.1080/07350015.2016.1245622.
Patton, Andrew J., Johanna F. Ziegel, and Rui Chen. 2019. “Dynamic Semiparametric Models for Expected Shortfall (and Value-at-Risk).” Journal of Econometrics 211 (2): 388–413. https://doi.org/10.1016/j.jeconom.2018.10.008.
Taylor, Ross. 2018. PyFlux: An Open Source Time Series Library for Python. https://github.com/rjt1990/pyflux.