---
title: "Decomposition of X-11 algorithm"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Decomposition of X-11 algorithm}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r}
java_correct <- rjd3highfreq::check_java_version()  
  
knitr::opts_chunk$set(  
    echo = TRUE,  
    eval = java_correct  
) 
```

```{r java-check, echo=FALSE, results="asis"}
if (!java_correct) {  
    cat("  
This vignette requires Java 21 or newer.   
The computational examples were therefore skipped.  
") 
}
```

## Standard X-11 decomposition

```{r}
library("rjd3highfreq")

x11decomp  <- x11plus(
    series = rjd3toolkit::ABS$X0.2.09.10.M,
    period = 12
)

plot(x11decomp)
```

Changing trend settings

```{r}

x11decomp  <- x11plus(
    series = rjd3toolkit::ABS$X0.2.09.10.M,
    period = 12,
    trend_horizon = 99
)

plot(x11decomp)
```
