# Package Demo

#### Alexios Galanos

#### 2026-05-22

# Estimation

We use the Deutsche Mark British Pound dataset for this demonstration throughout the document.

Code

    library(tsgarch)
    suppressMessages(library(data.table))
    suppressMessages(library(xts))
    data(dmbp)
    dmbp <- xts(dmbp, as.Date(seq_len(nrow(dmbp)), origin = '1970-01-01'))
    spec <- garch_modelspec(dmbp[1:1500,1], model = 'fgarch', constant = TRUE,
                            init = 'unconditional', distribution = 'jsu')
    mod <- estimate(spec)
    as_flextable(summary(mod))

FGARCH Model Summary
| Estimate | Std. Error | t value | Pr(>|t|) |
--- | --- | --- | --- | --- | ---
μ\muμ | -0.0154 | 0.0099 | -1.5574 | 0.1194 |
ω\omega ω | 0.0050 | 0.0032 | 1.5543 | 0.1201 |
α 1\alpha_1 α 1​ | 0.1621 | 0.0373 | 4.3419 | 0.0000 | ***
γ 1\gamma_1 γ 1​ | -0.3522 | 0.1108 | -3.1776 | 0.0015 | **
η 1\eta_1 η 1​ | 0.7829 | 0.1594 | 4.9108 | 0.0000 | ***
β 1\beta_1 β 1​ | 0.8727 | 0.0278 | 31.4083 | 0.0000 | ***
δ\delta δ | 1.4659 | 0.3593 | 4.0799 | 0.0000 | ***
ζ\zeta ζ | -0.2595 | 0.0835 | -3.1076 | 0.0019 | **
ν\nu ν | 1.4762 | 0.1046 | 14.1174 | 0.0000 | ***
P P P | 0.9903 | 0.0104 | 95.0454 | 0.0000 | ***
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
variance targeting: FALSE
initialization value: 0.2405
LogLik: -829.1715
AIC: 1678 | BIC: 1731
Model Equation
z t=ε t σ t∼J S U(0, 1, ζ, ν)z_t = \frac{\varepsilon_t}{\sigma_t} \sim JSU\left(0,1,\zeta, \nu\right)z t​=σ t​ε t​​∼J S U(0, 1, ζ, ν)
σ t δ=ω+α 1 σ t−j δ(∣z t−1−η 1∣−γ 1(z t−1−η 1))δ+β 1 σ t−1 δ \sigma^{\delta}_t = \omega + \alpha_1 \sigma^{\delta}_{t-j}\left(\left|z_{t-1} - \eta_1\right| - \gamma_1 \left(z_{t-1} - \eta_1\right)\right)^{\delta} + \beta_1 \sigma^{\delta}_{t-1}σ t δ​=ω+α 1​σ t−j δ​(∣z t−1​−η 1​∣−γ 1​(z t−1​−η 1​))δ+β 1​σ t−1 δ​
Persistence (P) and Unconditional Variance Equations
P=∑j=1 p β j+∑j=1 q α j κ j, κ j=E[(∣z t−j−η j∣−γ j(z t−j−η j))δ]P = \sum_{j=1}^p \beta_j + \sum_{j=1}^q \alpha_j \kappa_j,\quad \kappa_j = E\left[\left(\left|z_{t-j} - \eta_j\right| - \gamma_j \left(z_{t-j} - \eta_j\right)\right)^{\delta}\right]P=∑j=1 p​β j​+∑j=1 q​α j​κ j​,κ j​=E[(∣z t−j​−η j​∣−γ j​(z t−j​−η j​))δ]
E[ε t 2]=(ω 1−P)2/δ E\left[\varepsilon^2_t\right] = \left(\frac{\omega}{1 - P}\right)^{2/\delta}E[ε t 2​]=(1−P ω​)2/δ

Notice that the `as_flextable` method provides a publication-ready option for printing out the model summary.

We next take a look at a summary plot of the estimated model:

Code

    oldpar <- par(mfrow = c(1,1))
    par(mar = c(2,2,2,2))
    plot(mod)

Code

    par(oldpar)

Notice the news impact curve which is both shifted and rotated, a particularly appealing feature of the Family GARCH model.

# Simulation and Prediction

The code below shows how to predict from an estimated model and how to simulate using a specification with fixed parameters.

Code

    delta <- coef(mod)["delta"]
    new_spec <- spec
    new_spec$parmatrix <- copy(mod$parmatrix)
    sim <- simulate(new_spec, nsim = 100, h = 1000, seed = 100, burn = 250)
    mean_sim <- mean(rowMeans(sim$sigma^delta))^(2/delta)
    pred <- predict(mod, h = 1000, nsim = 0)
    oldpar <- par(mfrow = c(1,1))
    par(mar = c(2,2,2,2))
    plot(as.numeric(pred$sigma^2), type = "l", xlab = "horizon",
         ylab = expression(sigma^2), ylim = c(0.25, 0.41), main = "Family GARCH - JSU Prediction")
    abline(h = as.numeric(unconditional(mod)), col = 2)
    abline(h = mean_sim, col = 3)
    legend("bottomright", c("h-step prediction","unconditional variance","simulated unconditional variance"), col = c(1,2,3), lty = 1, bty = "n")

Code

    par(oldpar)

# Conclusion

There are other methods available, including methods for profiling the parameter distribution (`tsprofile`) and backtesting (`tsbacktest`), as well as methods for extracting information from the estimated object such as `vcov`, `pit` (probability integral transform), and `confint`.

The package includes focused unit tests for core behavior. Additional testing helpers and diagnostics are available in the tstests package.