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:
Choose a name for the distribution and parametrization, such as
newdistr
and newparam
, respectively.
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.
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.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.
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.
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.
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).
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).