Package 'rjd3highfreq'

Title: Seasonal Adjustment of High Frequency Data with 'JDemetra+ 3.x'
Description: R Interface to 'JDemetra+ 3.x' (<https://github.com/jdemetra>) time series analysis software. It provides functions for seasonal adjustment of high-frequency data displaying multiple, non integer periodicities. Pre-adjustment with extended airline model and Arima Model Based decomposition.
Authors: Jean Palate [aut, cre], Tanguy Barthelemy [ctb, art]
Maintainer: Jean Palate <[email protected]>
License: file LICENSE
Version: 2.4.1
Built: 2026-06-04 06:50:29 UTC
Source: https://github.com/rjdverse/rjd3highfreq

Help Index


Extract an ARIMA model from a Java object

Description

This internal function retrieves the ARIMA specification associated with a given path in a Java object. It extracts the model structure (description string, AR/MA polynomials, differencing order) and the innovation variance, and returns them as an R 'arima_model' object.

Usage

.arima_extract(jrslt, path)

Arguments

jrslt

Java object containing the estimated RegARIMA.

path

Character string specifying the extraction path within the Java object

Value

An 'arima_model' object as constructed by 'rjd3toolkit::arima_model()'.


Estimate parameters of an Extended Airline RegARIMA model

Description

This internal function performs maximum likelihood estimation of an Extended Airline model that has been previously specified and initialized.

Usage

.extended_airline_estimation(
  jregarima,
  jspec,
  eps = 1e-09,
  deps = 1e-09,
  exactHessian = FALSE
)

Arguments

jregarima

A Java RegArimaModel object, for instance created using .extended_airline_regarima.

jspec

A Java ExtendedAirlineSpec object, for instance created using .extended_airline_spec.

eps

Numeric scalar specifying the convergence tolerance for the optimization algorithm.

deps

Numeric scalar. Step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4.

exactHessian

Logical. If TRUE, computes the exact Hessian matrix at the optimum for calculating standard errors. If FALSE (default), uses a numerical approximation.

Value

A list object containing detailed estimation results.

Examples

## Not run: 
.extended_airline_estimation(jregarima, jspec, eps=1e-9, exactHessian=FALSE)

## End(Not run)

Log-Level Test for Extended Airline Models

Description

This internal function performs a statistical test to determine whether data should be transformed to logarithmic scale or kept in level (original scale)

Usage

.extended_airline_loglevel(jregarima, jspec, precision = 1e-05, deps = 1e-04)

Arguments

jregarima

Java object containing the already estimated RegARIMA model.

jspec

Java object containing the Extended Airline model specifications.

precision

Numeric value specifying the tolerance for convergence of optimization algorithms. Default: 1e-5.

deps

Numeric scalar. Step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4.

Value

An object containing the log-level test results.

Examples

## Not run: 
log_level_test_results <- .extended_airline_loglevel(jregarima, jspec, precision=1e-5)

## End(Not run)

Outlier Detection for Extended Airline Models

Description

This internal function performs automatic outlier detection in high-frequency time series using Extended Airline models.

Usage

.extended_airline_outliers(
  jregarima,
  jspec,
  types = c("ao"),
  start = 0,
  end = 0,
  critical_value = 0,
  max_outliers = 30,
  max_round = 30,
  precision = 1e-05,
  deps = 1e-04
)

Arguments

jregarima

Java object containing the estimated RegARIMA model.

jspec

Java object containing the Extended Airline model specifications.

types

Character vector specifying the types of outliers to detect. Default: c("ao") (additive outliers only). Common options include:

  • "ao" - Additive Outlier

  • "ls" - Level Shift

  • "wo" - Switch Outlier

start

Integer specifying the starting position (1-based R indexing) for outlier detection. Default: 0 (detection from the beginning of the series).

end

Integer specifying the ending position (1-based R indexing) for outlier detection. Default: 0 (detection until the end of the series).

critical_value

Numeric value for the critical value threshold. Uses the maximum value among the specified value and a global max-t threshold based on extreme-value theory, roughly of order sqrt(2 * log(n))). Default: 0 (global max-t threshold is used).

max_outliers

Integer specifying the maximum number of outliers to detect. Default: 30.

max_round

Integer specifying the maximum number of detection iterations. Default: 30.

precision

Numeric value specifying the tolerance for convergence of optimization algorithms. Default: 1e-5.

deps

Numeric scalar. Step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4.

Value

A numeric matrix with dimensions [number of outliers detected × 2]:

Examples

## Not run: 
outliers_window <- .extended_airline_outliers(
  jreg, jspec,
  types = c("ao", "ls"),
  start = 100,
  end = 500,
  critical_value = 6.0
)

## End(Not run)

Create a RegARIMA model based on an Extended Airline specification

Description

This internal function constructs a Java RegArimaModel object by fitting an Extended Airline model.

Usage

.extended_airline_regarima(y, jspec, mean = FALSE, X = NULL)

Arguments

y

Numeric vector containing the time series to be modeled.

jspec

A Java ExtendedAirlineSpec object, for instance created using .extended_airline_spec.

mean

Logical. If TRUE, includes a mean correction term in the model. Default: FALSE.

X

Optional matrix of regression variables. Default: NULL (no regressors).

Value

A Java object of class RegArimaModel from the JDemetra+ toolkit.

Examples

jspec<-.extended_airline_spec(c(12))
.extended_airline_regarima(rjd3toolkit::ABS$X0.2.09.10.M, jspec)

Create a specification for the Extended Airline model

Description

This internal function constructs a Java ExtendedAirlineSpec object. The Extended Airline model is an extension of the classic seasonal ARIMA model that can handle multiple simultaneous periodicities.

Usage

.extended_airline_spec(
  periodicities,
  differencing = -1,
  ar = FALSE,
  toint = FALSE
)

Arguments

periodicities

Numeric vector of periodicities present in the data. For example, c(7, 365.25) indicates weekly and annual seasonality.

differencing

Differencing order to apply. The default value -1 activates automatic computation based on the number of periodicities: if ar=FALSE, the order will be length(periodicities) + 1, otherwise it will equal length(periodicities). Positive values manually specify the differencing order.

ar

Logical. If TRUE, uses a regular stationary autoregressive (AR) polynomial instead of a moving average (MA) polynomial. Default: FALSE. This choice affects the automatic differencing order.

toint

Logical. If TRUE, rounds periodicity values to integers before processing. Default: FALSE.

Value

A Java object of class ExtendedAirlineSpec.

Examples

# Specification for daily data with weekly and annual seasonality
spec1 <- .extended_airline_spec(c(7, 365.25))

# Specification with manual differencing order
spec2 <- .extended_airline_spec(c(7, 365.25), differencing = 2)

# Using AR instead of MA, with rounding of periodicities
spec3 <- .extended_airline_spec(c(7, 365.25), ar = TRUE, toint = TRUE)

Create a custom plot replicating the JD+ GUI visual style

Description

This internal function generates a time series plot that replicates the visual template of the JD+ graphical user interface. The function supports plotting one or more time series simultaneously.

Usage

.plot_jd(x, y, col, legend_txt = NULL, ...)

Arguments

x

Numeric vector representing the x-axis values, typically a R time series object.

y

A list of numeric vectors, where each element represents a different time series to be plotted on the y-axis.

col

A character or color vector specifying the color assigned to each series.

legend_txt

An optional character vector of labels for the legend.

...

Additional graphical parameters. Can be used to customize line types (lty), line widths (lwd), or other aesthetic properties that apply uniformly to all series.

Value

'NULL' (invisible).


Extract a specific UCM component from a Java UcarimaModel object

Description

This internal function retrieves a single component from a UCM (Unobserved Components Model) result object returned by the Java backend. The component can be specified either by name or by its integer code.

Usage

.ucm_extract(jrslt, cmp)

Arguments

jrslt

Java UcarimaModel object.

cmp

Character string or integer specifying the component to extract. Valid components are:

  • "Series" or 1 : Complete series (Trend + Seasonal + Irregular + CalendarEffect)

  • "Trend" or 2 : Trend / level component

  • "Seasonal" or 3 : Seasonal component

  • "SeasonallyAdjusted" or 4 : Trend + Seasonal + CalendarEffect

  • "Irregular" or 5 : Irregular / residual component

  • "CalendarEffect" or 6 : Calendar effects (e.g., holidays)

Value

The requested component extracted from the UCM result.

Examples

## Not run: 
# Assume `jucm` is a UcarimaModel Java object

# Extract the trend component
trend <- .ucm_extract(jucm, "Trend")

## End(Not run)

Perform an Arima Model Based (AMB) decomposition

Description

Performs an Arima Model Based (AMB) decomposition using a (fractional) airline model, suitable for high-frequency time series. The method decomposes the input series into trend, seasonal and irregular components, with optional signal–noise decomposition.

Usage

fractionalAirlineDecomposition(
  y,
  period,
  sn = FALSE,
  stde = FALSE,
  nbcasts = 0,
  nfcasts = 0,
  eps = 1e-09,
  deps = 1e-04,
  log = FALSE,
  y_time = NULL
)

Arguments

y

input time series.

period

period of the seasonal component, any positive real number.

sn

decomposition into signal and noise (2 components only). The signal is the seasonally adjusted series and the noise the seasonal component. Default: FALSE.

stde

Boolean: TRUE: compute standard deviations of the components. In some cases (e.g. memory limits), it is currently not possible to compute them. Default: FALSE.

nbcasts

number of backcasts. Default: 0.

nfcasts

number of forecasts. Default: 0.

eps

precision of the optimisation routine. Default:1e-9.

deps

step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4

log

logical indicating whether the series is on the log scale. Default: FALSE.

y_time

vector of times at which 'y' is indexed. Optional.

adjust

Boolean: TRUE: actual fractional airline model is to be used, FALSE: the period is rounded to the nearest integer.

Details

If 'sn = TRUE', the decomposition is restricted to two components only (signal and noise). When 'stde = TRUE', the computation of standard deviations may fail for long series or high-frequency data due to memory constraints.

Value

An object containing the AMB decomposition results, including the estimated components and, if requested, their standard deviations.

Examples

## Not run: 
amb.dow <- rjd3highfreq::fractionalAirlineDecomposition(
  y = linearized_data$y, # linearized series from preprocessing
  period = 7,
  log = TRUE, y_time = linearized_data$date)

amb.dow <- rjd3highfreq::fractionalAirlineDecomposition(
  y = linearized_data$y, # linearized series from preprocessing
  period = 365.2425,
  log = log, y_time = linearized_data$date)

## End(Not run)

Perform a raw AMB decomposition using a fractional airline model

Description

This function performs an Arima Model Based (AMB) decomposition based on a fractional airline model for a single seasonal periodicity and returns the raw Java decomposition object without any conversion to R structures.

Usage

fractionalAirlineDecomposition_raw(
  y,
  period,
  sn = FALSE,
  stde = FALSE,
  nbcasts = 0,
  nfcasts = 0,
  precision = 1e-12,
  deps = 1e-04
)

Arguments

y

input time series.

period

numeric value specifying the seasonal period. Must be a positive real number (e.g. 7 for weekly, 365.2425 for annual seasonality).

sn

logical. If TRUE, perform a signal–noise decomposition (two components only). The signal corresponds to the seasonally adjusted series and the noise to the seasonal component. Default is FALSE.

stde

logical. If TRUE, compute standard deviations of the components. Default is FALSE.

nbcasts

number of backcasts. Default is 0.

nfcasts

number of forecasts. Default is 0.

precision

numeric. Precision of the likelihood optimization.

deps

step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4

Details

It is mainly intended for internal use or for advanced users who need direct access to the underlying Java LightExtendedAirlineDecomposition object.

Value

A Java object of class jdplus.highfreq.base.core.extendedairline.decomposition.LightExtendedAirlineDecomposition containing the raw results of the AMB decomposition.

Examples

## Not run: 
# Raw decomposition with weekly periodicity
jdec <- fractionalAirlineDecomposition_raw(
  y = linearized_data$y,
  period = 7
)

jdec

## End(Not run)

Extract the state space form (SSF) representation from a fractional airline decomposition

Description

This function extracts the state space form (SSF) representation associated with a fractional airline AMB decomposition for a single seasonal periodicity. The SSF object is obtained from the Java backend and converted to an R-friendly representation using rjd3toolkit.

Usage

fractionalAirlineDecomposition_ssf(jdecomp)

Arguments

jdecomp

Java object returned by fractionalAirlineDecomposition_raw() or an equivalent fractional airline decomposition.

Details

It is mainly intended for diagnostic purposes or for advanced users who need access to the underlying state space model corresponding to the estimated Ucarima representation.

Value

An R object representing the state space form of the decomposition, derived from a Java SsfUcarimaEstimation object.

Examples

## Not run: 
# Raw fractional airline decomposition
jdec <- fractionalAirlineDecomposition_raw(
  y = linearized_data$y,
  period = 7
)

# Extract the state space form
ssf <- fractionalAirlineDecomposition_ssf(jdec)

ssf

## End(Not run)

Linearize a time series using a fractional airline model

Description

This function estimates a (fractional) airline RegARIMA model and returns the linearized series together with regression effects, outlier components, estimation results and likelihood diagnostics. It is typically used as a preprocessing step prior to AMB or UCM-based decompositions.

Usage

fractionalAirlineEstimation(
  y,
  periods,
  x = NULL,
  ndiff = 2,
  ar = FALSE,
  outliers = NULL,
  criticalValue = 6,
  precision = 1e-12,
  deps = 1e-04,
  approximateHessian = FALSE,
  nfcasts = 0,
  log = FALSE,
  y_time = NULL
)

Arguments

y

input time series.

periods

numeric vector of seasonal periods. Each value must be a positive real number (e.g. 7 for weekly, 365.2425 for annual seasonality).

x

optional matrix of user-defined regression variables (e.g. calendar regressors built using rjd3toolkit).

ndiff

integer specifying the number of regular differences. Default is 2.

ar

logical. If TRUE, an autoregressive component is included in the model. Default is FALSE.

outliers

character vector specifying the types of outliers to detect. Possible values include "AO", "LS" and "WO". Default is NULL (no automatic outlier detection).

criticalValue

numeric. Critical value for automatic outlier detection. Larger values imply more conservative detection. Default is 6.

precision

numeric. Precision of the likelihood optimization. Default is 1e-12.

deps

step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4

approximateHessian

logical. If TRUE, compute an approximate Hessian matrix based on the optimization procedure. Default is FALSE.

nfcasts

number of forecasts. Default is 0.

log

logical. If TRUE, the model is estimated on the log-scale. Default is FALSE.

y_time

optional vector of time indices associated with y.

Details

Automatic outlier detection can be enabled by specifying the outlier types and a critical value for the detection threshold.

Value

An object of class "JDFractionalAirlineEstimation" containing:

  • the original and linearized series,

  • estimated regression effects and outlier components,

  • model parameters and covariance matrices,

  • likelihood and diagnostic information.

Examples

## Not run: 
# input data
data <- list(
  y = rnorm(1000),
  date = seq.Date(from = as.Date("2020-01-01"),
                  by = "day",
                  length.out = 1000)
)

# Linearize the series using weekly and annual periodicities
est <- fractionalAirlineEstimation(
  y = data$y,
  periods = c(7, 365.2425),
  log = FALSE,
  y_time = data$date
)

# Extract linearized series for subsequent decompositions
linearized_data <- list(
  y = est$model$linearized,
  date = est$model$y_time
)

## End(Not run)

Convert a raw fractional airline decomposition to an R-friendly object

Description

This function takes a Java object returned by fractionalAirlineDecomposition_raw() and converts it into a structured R object of class JDFractionalAirlineDecomposition. The result includes the estimated Ucarima model, the decomposition components, standard errors (optional), parameter estimates, and likelihood diagnostics.

Usage

jd2r_fractionalAirlineDecomposition(
  jrslt,
  sn = FALSE,
  stde = FALSE,
  period,
  log = FALSE,
  y_time = NULL
)

Arguments

jrslt

Java object returned by fractionalAirlineDecomposition_raw().

sn

logical. If TRUE, perform a signal–noise decomposition (2 components only: seasonally adjusted series and seasonal component). Default is FALSE.

stde

logical. If TRUE, include standard deviations of the components in the returned decomposition. Default is FALSE.

period

numeric. Seasonal period corresponding to the decomposition.

log

logical. If TRUE, indicates that the decomposition was performed on a log-transformed series. Default is FALSE.

y_time

optional vector of time indices associated with the series y. Default is NULL.

Value

An object of class JDFractionalAirlineDecomposition containing:

  • ucarima: the Ucarima model with its components,

  • decomposition: list of original series, seasonally adjusted series, and components (trend, irregular, seasonal), with optional standard deviations,

  • estimation: estimated parameters, covariance matrix, and score,

  • likelihood: likelihood diagnostics.

Examples

## Not run: 
# Assume `linearized_data` contains the linearized series

# Raw fractional airline decomposition
jdec <- fractionalAirlineDecomposition_raw(
  y = linearized_data$y,
  period = 7
)

# Convert to R object with decomposition
amb_r <- jd2r_fractionalAirlineDecomposition(
  jdec,
  sn = FALSE,
  stde = TRUE,
  period = 7,
  log = FALSE,
  y_time = linearized_data$date
)

# Access the seasonally adjusted series
sa <- amb_r$decomposition$sa

## End(Not run)

Convert a raw multi-period AMB decomposition to an R-friendly object

Description

This function takes a Java object returned by multiAirlineDecomposition_raw() and converts it into a structured R object of class JDFractionalAirlineDecomposition. The result includes the estimated Ucarima model, the decomposition components, standard errors (optional), parameter estimates, and likelihood diagnostics.

Usage

jd2r_multiAirlineDecomposition(
  jrslt,
  stde = FALSE,
  periods,
  log = FALSE,
  y_time = NULL
)

Arguments

jrslt

Java object returned by multiAirlineDecomposition_raw().

stde

logical. If TRUE, include standard deviations of the components in the returned decomposition. Default is FALSE.

periods

numeric vector of seasonal periods corresponding to the decomposition.

log

logical. If TRUE, indicates that the decomposition was performed on a log-transformed series. Default is FALSE.

y_time

optional vector of time indices associated with the series y. Default is NULL.

Value

An object of class JDFractionalAirlineDecomposition containing:

  • ucarima: the Ucarima model with its components,

  • decomposition: list of original series, seasonally adjusted series, and component time series (with optional standard deviations),

  • estimation: estimated parameters, covariance matrix, and score,

  • likelihood: likelihood diagnostics.

Examples

## Not run: 
# Assume `linearized_data` contains a (linearized) time series

# Raw multi-period decomposition
jdec <- multiAirlineDecomposition_raw(
  y = linearized_data$y,
  periods = c(7, 365.2425)
)

# Convert to R object with decomposition
amb_r <- jd2r_multiAirlineDecomposition(jdec,
                                       stde = TRUE,
                                       periods = c(7, 365.2425),
                                       log = FALSE,
                                       y_time = linearized_data$date)

# Access the seasonally adjusted series
sa <- amb_r$decomposition$sa

## End(Not run)

Perform an Arima Model Based (AMB) decomposition with multiple periodicities

Description

This function performs an AMB decomposition based on (fractional) airline models allowing for multiple seasonal periodicities at once. It is intended for high-frequency time series where more than one seasonal cycle may be present (e.g. weekly and annual effects).

Usage

multiAirlineDecomposition(
  y,
  periods,
  ndiff = 2,
  ar = FALSE,
  stde = FALSE,
  nbcasts = 0,
  nfcasts = 0,
  eps = 1e-09,
  deps = 1e-04,
  log = FALSE,
  y_time = NULL
)

Arguments

y

input time series.

periods

numeric vector of seasonal periods. Each value must be a positive real number (e.g. 7 for weekly, 365.2425 for annual seasonality).

ndiff

integer specifying the number of regular differences. Default is 2.

ar

logical. If TRUE, an autoregressive component is included in the model. Default is FALSE.

stde

logical. If TRUE, compute standard deviations of the components. In some cases (e.g. memory limits), it may not be possible to compute them. Default is FALSE.

nbcasts

number of backcasts. Default is 0.

nfcasts

number of forecasts. Default is 0.

eps

precision of the optimisation routine. Default:1e-9.

deps

step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4

log

logical. If TRUE, the decomposition is returned on the log-scale. Default is FALSE.

y_time

optional vector of time indices associated with y.

Details

If a single period is supplied, the function falls back to fractionalAirlineDecomposition().

Value

A decomposition object containing the estimated components for each periodicity. If multiple periods are provided, a multi-period decomposition is returned.

Examples

## Not run: 
# Assume `linearized_data` contains the linearized series

# Weekly and annual periodicities
amb.multi <- multiAirlineDecomposition(
  y = linearized_data$y,
  periods = c(7, 365.2425),
  log = log,
  y_time = linearized_data$date
)

## End(Not run)

Perform a raw multi-period AMB decomposition using fractional airline models

Description

This function performs an Arima Model Based (AMB) decomposition with one or more seasonal periodicities, and returns the raw Java decomposition object without any post-processing or conversion to R structures.

Usage

multiAirlineDecomposition_raw(
  y,
  periods,
  ndiff = 2,
  ar = FALSE,
  stde = FALSE,
  nbcasts = 0,
  nfcasts = 0,
  precision = 1e-12,
  deps = 1e-04
)

Arguments

y

input time series.

periods

numeric vector of seasonal periods. Each value must be a positive real number (e.g. 7 for weekly, 365.2425 for annual seasonality).

ndiff

integer specifying the number of regular differences. Default is 2.

ar

logical. If TRUE, an autoregressive component is included in the model. Default is FALSE.

stde

logical. If TRUE, compute standard deviations of the components. Default is FALSE.

nbcasts

number of backcasts. Default is 0.

nfcasts

number of forecasts. Default is 0.

precision

numeric. Precision of the likelihood optimization. Default is 1e-12.

deps

step in the computation of the numerical derivatives, used in the optimisation routine. Default:1e-4

Details

It is mainly intended for internal use or for advanced users who need direct access to the underlying Java object (LightExtendedAirlineDecomposition).

Value

A Java object of class jdplus.highfreq.base.core.extendedairline.decomposition.LightExtendedAirlineDecomposition containing the raw results of the AMB decomposition.

Examples

## Not run: 
# Raw decomposition with weekly and annual periodicities
jdec <- multiAirlineDecomposition_raw(
  y = linearized_data$y,
  periods = c(7, 365.2425)
)

# The returned object is a Java object
jdec

## End(Not run)

Extract the state space form (SSF) representation from a multi-airline sdecomposition

Description

This function extracts the state space form (SSF) representation associated with a fractional airline AMB decomposition. The SSF object is obtained from the Java backend and converted to an R-friendly representation using rjd3toolkit.

Usage

multiAirlineDecomposition_ssf(jdecomp)

Arguments

jdecomp

Java object returned by multiAirlineDecomposition_raw() or an equivalent fractional airline decomposition.

Details

It is mainly intended for diagnostic purposes or for advanced users who need access to the underlying state space model corresponding to the estimated Ucarima representation.

Value

An R object representing the state space form of the decomposition, derived from a Java SsfUcarimaEstimation object.

Examples

## Not run: 
# Raw multi-period decomposition
jdec <- multiAirlineDecomposition_raw(
  y = linearized_data$y,
  periods = c(7, 365.2425)
)

# Extract the state space form
ssf <- multiAirlineDecomposition_ssf(jdec)

ssf

## End(Not run)

Plot method for JDFractionalAirlineDecomposition objects

Description

This function implements the plot S3 method for objects of class JDFractionalAirlineDecomposition. It produces one or two JD+-styled plots (via .plot_jd).

Usage

## S3 method for class 'JDFractionalAirlineDecomposition'
plot(x, from, to, type_chart = c("y-sa-trend", "cal-seas-irr"), ...)

Arguments

x

An object of class JDFractionalAirlineDecomposition, as returned by the fractional airline decomposition functions.

from

An optional Date or POSIXt object specifying the start of the time window to display.

to

An optional Date or POSIXt object specifying the end of the time window to display.

type_chart

Character vector specifying which chart(s) to render. Accepts one or both of the following values:

  • "y-sa-trend" — plots the raw data, seasonally adjusted series, and trend-cycle component (default)

  • "cal-seas-irr" — plots all seasonal components and the irregular component

...

Additional graphical parameters passed through to .plot_jd.

Value

'NULL' (invisible).

Examples

## Not run: 
# Assuming 'decomp' is a JDFractionalAirlineDecomposition object

# --- Default: render both charts sequentially ---------------------------
plot(decomp)

# --- Render only the raw / SA / trend chart -----------------------------
plot(decomp, type_chart = "y-sa-trend")

# --- Restrict both charts to a specific time window ----------------------
plot(decomp,
     from = as.Date("2016-01-01"),
     to   = as.Date("2022-12-31"))

# --- Both charts stacked vertically with a custom line width --------------
par(mfrow = c(2, 1))
plot(decomp,
     from = as.Date("2018-01-01"),
     to   = as.Date("2023-06-30"),
     main = "Stacked view",
     lwd  = 2)
par(mfrow = c(1, 1))   # reset layout

## End(Not run)

Plot method for JDFractionalAirlineEstimation objects

Description

This function implements the plot S3 method for objects of class JDFractionalAirlineEstimation.

Usage

## S3 method for class 'JDFractionalAirlineEstimation'
plot(x, from, to, ...)

Arguments

x

An object of class JDFractionalAirlineEstimation, as returned by the fractional airline estimation functions.

from

An optional Date or POSIXt object specifying the start of the time window to display.

to

An optional Date or POSIXt object specifying the end of the time window to display.

...

Additional graphical parameters passed to .plot_jd.

Value

'NULL' (invisible).

Examples

## Not run: 
# Assuming 'estimation' is a JDFractionalAirlineEstimation object
# Basic plot: raw data vs. linearised series
plot(estimation)

# Plot restricted to a specific time window
plot(estimation,
     from = as.Date("2015-01-01"),
     to   = as.Date("2020-12-31"))

# Combining time window, custom title and line width
plot(estimation,
     from = as.Date("2018-06-01"),
     to   = as.Date("2023-01-01"),
     main = "Filtered window",
     lwd  = 2)

## End(Not run)

Print method for JDFractionalAirlineDecomposition objects

Description

This function implements the print S3 method for objects of class JDFractionalAirlineDecomposition.

Usage

## S3 method for class 'JDFractionalAirlineDecomposition'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

x

An object of class JDFractionalAirlineDecomposition, as returned by the fractional airline decomposition functions

digits

Integer. Number of significant digits used to format all numeric values in the output.

...

Additional arguments.

Value

The function returns the input object x.

Examples

## Not run: 
# Assuming 'decomp' is a JDFractionalAirlineDecomposition object

# --- Basic print (dispatched automatically) ------------------------------
print(decomp)

## End(Not run)

Print method for JDFractionalAirlineEstimation objects

Description

This function implements the print S3 method for objects of class JDFractionalAirlineEstimation.

Usage

## S3 method for class 'JDFractionalAirlineEstimation'
print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

x

An object of class JDFractionalAirlineEstimation, as returned by the fractional airline estimation functions.

digits

Integer. Number of significant digits used to format all numeric values in the printed output.

...

Additional arguments.

Value

The function returns the input object x.

Examples

## Not run: 
# Assuming 'estimation' is a JDFractionalAirlineEstimation object

# --- Basic print (dispatched automatically) ------------------------------
print(estimation)

## End(Not run)