| Title: | 'ggplot2' Extension for Seasonal and Trading Day Adjustment with 'JDemetra+' 3.0 |
|---|---|
| Description: | Provides 'ggplot2' extensions for seasonal and trading day adjustment based on the R interface to 'JDemetra+' version 3.0. |
| Authors: | Alain Quartier-la-Tente [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-7890-3857>) |
| Maintainer: | Alain Quartier-la-Tente <[email protected]> |
| License: | EUPL |
| Version: | 0.0.3 |
| Built: | 2026-10-18 14:55:56 UTC |
| Source: | https://github.com/AQLT/ggdemetra3 |
Plot Seasonal Adjustment Objects
## S3 method for class 'JD3_X13_OUTPUT' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_TRAMOSEATS_OUTPUT' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_X13_RSLTS' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_TRAMOSEATS_RSLTS' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_Object' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'hf_decomposition' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), dates = NULL, ... )## S3 method for class 'JD3_X13_OUTPUT' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_TRAMOSEATS_OUTPUT' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_X13_RSLTS' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_TRAMOSEATS_RSLTS' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'JD3_Object' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), forecast = FALSE, ... ) ## S3 method for class 'hf_decomposition' autoplot( object, components = c("y", "sa", trend = "t", seasonal = "s", irregular = "i"), dates = NULL, ... )
object |
A seasonal adjustment model (from rjd3x13, rjd3tramoseats, or rjd3highfreq). |
components |
Components to display. Can be |
forecast |
Logical indicating whether the forecast series should be
plotted (default is |
... |
Additional arguments passed to methods. |
dates |
For |
A ggplot2 object representing the faceted components.
autoplot(rjd3x13::jx13(ipi_c_eu[, "FR"])) hf_data <- usclaims[usclaims$date <= "2019-12-01",] mod_hf <- rjd3highfreq::fractional_airline_decomposition( hf_data[, "Initial claims"], period = 52, series_time = hf_data[, "date"] ) autoplot(mod_hf, dates = usclaims$date[usclaims$date <= "2019-12-01"])autoplot(rjd3x13::jx13(ipi_c_eu[, "FR"])) hf_data <- usclaims[usclaims$date <= "2019-12-01",] mod_hf <- rjd3highfreq::fractional_airline_decomposition( hf_data[, "Initial claims"], period = 52, series_time = hf_data[, "date"] ) autoplot(mod_hf, dates = usclaims$date[usclaims$date <= "2019-12-01"])
Extract Components from Seasonal Adjustment Objects
seasonal(x, forecast = FALSE, calendar = FALSE, seas_freq = NULL, ...) trendcycle(x, forecast = FALSE, ...) irregular(x, forecast = FALSE, corrected = FALSE, ...) seasonaladj(x, forecast = FALSE, corrected = FALSE, ...) calendaradj(x, forecast = FALSE, spec = NULL, ...) calendar(x, forecast = FALSE, spec = NULL, ...) raw(x, forecast = FALSE, backcast = FALSE, spec = NULL, ...)seasonal(x, forecast = FALSE, calendar = FALSE, seas_freq = NULL, ...) trendcycle(x, forecast = FALSE, ...) irregular(x, forecast = FALSE, corrected = FALSE, ...) seasonaladj(x, forecast = FALSE, corrected = FALSE, ...) calendaradj(x, forecast = FALSE, spec = NULL, ...) calendar(x, forecast = FALSE, spec = NULL, ...) raw(x, forecast = FALSE, backcast = FALSE, spec = NULL, ...)
x |
A seasonal adjustment model (from rjd3x13, rjd3tramoseats, or rjd3highfreq). |
forecast, backcast
|
Logicals indicating whether the forecast or backcast series should be returned.
If |
calendar |
If |
seas_freq |
For methods with multiple seasonal frequencies
( |
... |
Additional arguments passed to methods. |
corrected |
If |
spec |
The specification used to estimate the model.
Only used for |
These functions are S3 generics supporting several classes from the rjdverse ecosystem:
X-13 models (rjd3x13): JD3_X13_OUTPUT, JD3_X13_RSLTS, JD3_Object;
TRAMO-SEATS models (rjd3tramoseats): JD3_TRAMOSEATS_OUTPUT, JD3_TRAMOSEATS_RSLTS;
High-frequency decompositions (rjd3highfreq): hf_decomposition
(except for calendaradj() and calendar(), which are not supported for this class).
A ts object (or a vector of numeric for "hf_decomposition" objects) containing the requested component.
A ts object with the requested component.
model <- rjd3x13::jx13(ipi_c_eu[, "FR"]) seasonal(model) raw(model, forecast = TRUE)model <- rjd3x13::jx13(ipi_c_eu[, "FR"]) seasonal(model) raw(model, forecast = TRUE)
Function to directly add the ARIMA model used in the pre-adjustment process of seasonal adjustment to the plot.
Only available for X-13 (rjd3x13::x13()) and TRAMO-SEATS (rjd3tramoseats::tramoseats()) methods.
geom_arima( mapping = NULL, data = NULL, stat = "arima", geom = c("text", "label"), position = "identity", ..., method = c("x13", "tramoseats"), spec = NULL, frequency = NULL, message = TRUE, x_arima = NULL, y_arima = NULL, show.legend = NA, inherit.aes = TRUE )geom_arima( mapping = NULL, data = NULL, stat = "arima", geom = c("text", "label"), position = "identity", ..., method = c("x13", "tramoseats"), spec = NULL, frequency = NULL, message = TRUE, x_arima = NULL, y_arima = NULL, show.legend = NA, inherit.aes = TRUE )
mapping |
Set of aesthetic mappings created by |
data |
A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
geom |
Character. The geometric object to use to display the data:
|
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
method |
The method used for the seasonal adjustment.
|
spec |
the specification used for the seasonal adjustment.
For |
frequency |
The frequency of the time series. By default ( |
message |
A logical value indicating whether a message is printed with the frequency used. |
x_arima, y_arima
|
Position of the ARIMA model text.
By default, the first position of the |
show.legend |
Logical. Should this layer be included in the legends?
|
inherit.aes |
If |
With geom = "text", the ARIMA model used in the pre-adjustment process of seasonal adjustment is directly added to the plot.
With geom = "label", a rectangle is drawn behind the ARIMA model text, making it easier to read.
A ggplot2 layer object to be added to a plot.
p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) + geom_sa(color = "red", message = FALSE) # To add the ARIMA model p_sa_ipi_fr + geom_arima( geom = "label", x_arima = -Inf, y_arima = -Inf, vjust = -1, hjust = -0.1, message = FALSE )p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) + geom_sa(color = "red", message = FALSE) # To add the ARIMA model p_sa_ipi_fr + geom_arima( geom = "label", x_arima = -Inf, y_arima = -Inf, vjust = -1, hjust = -0.1, message = FALSE )
Adds a table of diagnostics to the plot.
Only available for X-13 (rjd3x13::x13()) and TRAMO-SEATS (rjd3tramoseats::tramoseats()) methods.
geom_diagnostics( mapping = NULL, data = NULL, position = "identity", ..., method = c("x13", "tramoseats"), spec = NULL, frequency = NULL, message = TRUE, diagnostics = NULL, digits = 2, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf, table_theme = ttheme_default(), inherit.aes = TRUE )geom_diagnostics( mapping = NULL, data = NULL, position = "identity", ..., method = c("x13", "tramoseats"), spec = NULL, frequency = NULL, message = TRUE, diagnostics = NULL, digits = 2, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf, table_theme = ttheme_default(), inherit.aes = TRUE )
mapping |
Set of aesthetic mappings created by |
data |
A |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
method |
The method used for the seasonal adjustment.
|
spec |
The specification used for the seasonal adjustment.
For |
frequency |
The frequency of the time series. By default ( |
message |
A logical value indicating whether a message is printed with the frequency used. |
diagnostics |
Character vector containing the names of the diagnostics to plot.
See |
digits |
Integer indicating the number of decimal places to be used for numeric diagnostics (default is |
xmin, xmax
|
Horizontal location of the raster in data coordinates. |
ymin, ymax
|
Vertical location of the raster in data coordinates. |
table_theme |
List of theme parameters for the table of diagnostics (see |
inherit.aes |
If |
A ggplot2 layer object to be added to a plot.
p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) + geom_sa(color = "red", message = FALSE) # To add a table of diagnostics with the result of the X-11 combined test # and the p-values of the residual seasonality QS and F-tests: diagnostics <- c("diagnostics.seas-sa-combined", "diagnostics.seas-sa-qs", "diagnostics.seas-sa-f") p_sa_ipi_fr + geom_diagnostics( diagnostics = diagnostics, ymin = 58, ymax = 72, xmin = 2010, table_theme = gridExtra::ttheme_default(base_size = 8), message = FALSE ) # To customize the names of the diagnostics in the plot: diagnostics <- c( `Combined test` = "diagnostics.seas-sa-combined", `Residual qs-test (p-value)` = "diagnostics.seas-sa-qs", `Residual f-test (p-value)` = "diagnostics.seas-sa-f" ) p_sa_ipi_fr + geom_diagnostics( diagnostics = diagnostics, ymin = 58, ymax = 72, xmin = 2010, table_theme = gridExtra::ttheme_default(base_size = 8), message = FALSE ) # To add the table below the plot: p_diag <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_diagnostics( diagnostics = diagnostics, table_theme = gridExtra::ttheme_default(base_size = 8), message = FALSE ) + theme_void() gridExtra::grid.arrange( p_sa_ipi_fr, p_diag, nrow = 2, heights = c(4, 1) )p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) + geom_sa(color = "red", message = FALSE) # To add a table of diagnostics with the result of the X-11 combined test # and the p-values of the residual seasonality QS and F-tests: diagnostics <- c("diagnostics.seas-sa-combined", "diagnostics.seas-sa-qs", "diagnostics.seas-sa-f") p_sa_ipi_fr + geom_diagnostics( diagnostics = diagnostics, ymin = 58, ymax = 72, xmin = 2010, table_theme = gridExtra::ttheme_default(base_size = 8), message = FALSE ) # To customize the names of the diagnostics in the plot: diagnostics <- c( `Combined test` = "diagnostics.seas-sa-combined", `Residual qs-test (p-value)` = "diagnostics.seas-sa-qs", `Residual f-test (p-value)` = "diagnostics.seas-sa-f" ) p_sa_ipi_fr + geom_diagnostics( diagnostics = diagnostics, ymin = 58, ymax = 72, xmin = 2010, table_theme = gridExtra::ttheme_default(base_size = 8), message = FALSE ) # To add the table below the plot: p_diag <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_diagnostics( diagnostics = diagnostics, table_theme = gridExtra::ttheme_default(base_size = 8), message = FALSE ) + theme_void() gridExtra::grid.arrange( p_sa_ipi_fr, p_diag, nrow = 2, heights = c(4, 1) )
Function to directly add the outliers used in the pre-adjustment process of the seasonal adjustment to the plot.
Only available for X-13 (rjd3x13::x13()) and TRAMO-SEATS (rjd3tramoseats::tramoseats()) methods.
geom_outlier( mapping = NULL, data = NULL, stat = "outlier", geom = c("text", "label", "text_repel", "label_repel"), position = "identity", ..., method = c("x13", "tramoseats"), spec = NULL, frequency = NULL, message = TRUE, first_date = NULL, last_date = NULL, coefficients = FALSE, digits = 1, show.legend = NA, inherit.aes = TRUE )geom_outlier( mapping = NULL, data = NULL, stat = "outlier", geom = c("text", "label", "text_repel", "label_repel"), position = "identity", ..., method = c("x13", "tramoseats"), spec = NULL, frequency = NULL, message = TRUE, first_date = NULL, last_date = NULL, coefficients = FALSE, digits = 1, show.legend = NA, inherit.aes = TRUE )
mapping |
Set of aesthetic mappings created by |
data |
A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
geom |
Character. The geometry to use to display the data:
|
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
method |
The method used for the seasonal adjustment.
|
spec |
The specification used for the seasonal adjustment.
For |
frequency |
The frequency of the time series. By default ( |
message |
A logical value indicating whether a message is printed with the frequency used. |
first_date |
A numeric specifying the first date from which the outliers are plotted.
By default ( |
last_date |
A numeric specifying the last date up to which the outliers are plotted.
By default ( |
coefficients |
Logical indicating whether the estimated coefficients are printed.
By default |
digits |
Integer indicating the number of decimal places to be used for the estimated coefficients of the outliers.
By default |
show.legend |
Logical. Should this layer be included in the legends?
|
inherit.aes |
If |
With geom = "text", the outliers used in the pre-adjustment process of the seasonal adjustment are directly added to the plot.
With geom = "label", a rectangle is drawn behind the names of the outliers, making them easier to read.
The same applies to geom = "text_repel" or geom = "label_repel", but text labels are also repelled away from each other and away from the data points (see ggrepel::geom_label_repel()).
A ggplot2 layer object to be added to a plot.
p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) + geom_sa(color = "red", message = FALSE) # To add the outliers: p_sa_ipi_fr + geom_outlier( geom = "label", message = FALSE ) # To have a more readable plot with outlier names repelled away from each other # and from the data points: p_sa_ipi_fr + geom_outlier( geom = "label_repel", message = FALSE, vjust = 4, ylim = c(NA, 65), force = 10, arrow = arrow( length = unit(0.03, "npc"), type = "closed", ends = "last" ) ) # To only plot the outliers from a specific date (2009): p_sa_ipi_fr + geom_outlier( geom = "label_repel", message = FALSE, first_date = 2009, vjust = 4, ylim = c(NA, 65), force = 10, arrow = arrow( length = unit(0.03, "npc"), type = "closed", ends = "last" ) )p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) + geom_sa(color = "red", message = FALSE) # To add the outliers: p_sa_ipi_fr + geom_outlier( geom = "label", message = FALSE ) # To have a more readable plot with outlier names repelled away from each other # and from the data points: p_sa_ipi_fr + geom_outlier( geom = "label_repel", message = FALSE, vjust = 4, ylim = c(NA, 65), force = 10, arrow = arrow( length = unit(0.03, "npc"), type = "closed", ends = "last" ) ) # To only plot the outliers from a specific date (2009): p_sa_ipi_fr + geom_outlier( geom = "label_repel", message = FALSE, first_date = 2009, vjust = 4, ylim = c(NA, 65), force = 10, arrow = arrow( length = unit(0.03, "npc"), type = "closed", ends = "last" ) )
Performs a seasonal adjustment and plots a specific component of the decomposition.
geom_sa() and stat_sa() are aliases: they both use the same arguments.
Use stat_sa() if you want to display the results with a non-standard geom.
geom_sa( mapping = NULL, data = NULL, stat = "sa", position = "identity", ..., method = c("x13", "tramoseats", "x11-extended", "fractionalairline", "multiairline", "stl", "istl", "mstl"), spec = NULL, frequency = NULL, message = TRUE, component = "sa", show.legend = NA, inherit.aes = TRUE ) stat_sa( mapping = NULL, data = NULL, geom = "line", position = "identity", ..., method = c("x13", "tramoseats", "x11-extended", "fractionalairline", "fractionalairlineestimation", "multiairline", "stl", "istl", "mstl"), spec = NULL, frequency = NULL, message = TRUE, component = "sa", show.legend = NA, inherit.aes = TRUE )geom_sa( mapping = NULL, data = NULL, stat = "sa", position = "identity", ..., method = c("x13", "tramoseats", "x11-extended", "fractionalairline", "multiairline", "stl", "istl", "mstl"), spec = NULL, frequency = NULL, message = TRUE, component = "sa", show.legend = NA, inherit.aes = TRUE ) stat_sa( mapping = NULL, data = NULL, geom = "line", position = "identity", ..., method = c("x13", "tramoseats", "x11-extended", "fractionalairline", "fractionalairlineestimation", "multiairline", "stl", "istl", "mstl"), spec = NULL, frequency = NULL, message = TRUE, component = "sa", show.legend = NA, inherit.aes = TRUE )
mapping |
Set of aesthetic mappings created by |
data |
A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
method |
The method used for the seasonal adjustment.
|
spec |
The specification used for the seasonal adjustment.
For |
frequency |
The frequency of the time series. By default ( |
message |
A logical value indicating whether a message is printed with the frequency used. |
component |
A character string specifying the component to plot. The result must be a time series.
See |
show.legend |
Logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom |
The geometric object to use to display the data. |
A ggplot2 layer object to be added to a plot.
p_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) # To add the seasonally adjusted series: p_ipi_fr + geom_sa(color = "red") # To add the forecasts of the input data and the seasonally adjusted series: p_sa <- p_ipi_fr + geom_sa(component = "y_f", linetype = 2, message = FALSE) + geom_sa(component = "sa", color = "red", message = FALSE) + geom_sa(component = "sa_f", color = "red", linetype = 2, message = FALSE) p_sap_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) + geom_line() + labs( title = "Seasonal adjustment of the French industrial production index", x = "time", y = NULL ) # To add the seasonally adjusted series: p_ipi_fr + geom_sa(color = "red") # To add the forecasts of the input data and the seasonally adjusted series: p_sa <- p_ipi_fr + geom_sa(component = "y_f", linetype = 2, message = FALSE) + geom_sa(component = "sa", color = "red", message = FALSE) + geom_sa(component = "sa_f", color = "red", linetype = 2, message = FALSE) p_sa
Set of ggplot2 plotting functions for filters and moving averages generated by the rjd3filters package.
ggplot_coef(x, zero_as_na = TRUE, ylab = "Coefficients", ...) ## S3 method for class 'finite_filters' ggplot_coef(x, zero_as_na = TRUE, ylab = "Coefficients", q = 0, ...) ## S3 method for class 'moving_average' ggplot_coef(x, zero_as_na = TRUE, ylab = "Coefficients", ...) ggplot_gain(x, nxlab = 7, xlim = c(0, pi), ..., n = 101) ## S3 method for class 'finite_filters' ggplot_gain(x, nxlab = 7, xlim = c(0, pi), q = 0, ..., n = 101) ## S3 method for class 'moving_average' ggplot_gain(x, nxlab = 7, xlim = c(0, pi), ..., n = 101) ggplot_phase(x, nxlab = 7, xlim = c(0, pi), normalized = FALSE, ..., n = 101) ## S3 method for class 'finite_filters' ggplot_phase( x, nxlab = 7, xlim = c(0, pi), normalized = FALSE, q = 0, ..., n = 101 ) ## S3 method for class 'moving_average' ggplot_phase(x, nxlab = 7, xlim = c(0, pi), normalized = FALSE, ..., n = 101)ggplot_coef(x, zero_as_na = TRUE, ylab = "Coefficients", ...) ## S3 method for class 'finite_filters' ggplot_coef(x, zero_as_na = TRUE, ylab = "Coefficients", q = 0, ...) ## S3 method for class 'moving_average' ggplot_coef(x, zero_as_na = TRUE, ylab = "Coefficients", ...) ggplot_gain(x, nxlab = 7, xlim = c(0, pi), ..., n = 101) ## S3 method for class 'finite_filters' ggplot_gain(x, nxlab = 7, xlim = c(0, pi), q = 0, ..., n = 101) ## S3 method for class 'moving_average' ggplot_gain(x, nxlab = 7, xlim = c(0, pi), ..., n = 101) ggplot_phase(x, nxlab = 7, xlim = c(0, pi), normalized = FALSE, ..., n = 101) ## S3 method for class 'finite_filters' ggplot_phase( x, nxlab = 7, xlim = c(0, pi), normalized = FALSE, q = 0, ..., n = 101 ) ## S3 method for class 'moving_average' ggplot_phase(x, nxlab = 7, xlim = c(0, pi), normalized = FALSE, ..., n = 101)
x |
coefficients, gain or phase. |
zero_as_na |
boolean indicating if the trailing zero of the coefficients should be plotted ( |
ylab |
A character string specifying the y-axis label. |
... |
other arguments to |
q |
q. |
nxlab |
number of xlab. |
xlim |
vector containing x limits. |
n |
number of points used to plot the functions. |
normalized |
boolean indicatif if the phase function is normalized by the frequency. |
A ggplot2 object representing the coefficients, gain or phase of the filter.
filter <- rjd3filters::lp_filter(6, endpoints = "DAF", kernel = "Henderson") ggplot_coef(filter, q = c(0,3)) ggplot_gain(filter, q = c(0,3)) ggplot_phase(filter, q = c(0,3))filter <- rjd3filters::lp_filter(6, endpoints = "DAF", kernel = "Henderson") ggplot_coef(filter, q = c(0,3)) ggplot_gain(filter, q = c(0,3)) ggplot_phase(filter, q = c(0,3))
Initialise a 'ggplot2' Object with an SA Model
init_ggplot(x, ...) ## S3 method for class 'JD3_X13_OUTPUT' init_ggplot(x, context = NULL, ...) ## S3 method for class 'JD3_TRAMOSEATS_OUTPUT' init_ggplot(x, context = NULL, ...) ## S3 method for class 'JD3_Object' init_ggplot(x, ...) ## S3 method for class 'hf_decomposition' init_ggplot(x, dates = NULL, ...)init_ggplot(x, ...) ## S3 method for class 'JD3_X13_OUTPUT' init_ggplot(x, context = NULL, ...) ## S3 method for class 'JD3_TRAMOSEATS_OUTPUT' init_ggplot(x, context = NULL, ...) ## S3 method for class 'JD3_Object' init_ggplot(x, ...) ## S3 method for class 'hf_decomposition' init_ggplot(x, dates = NULL, ...)
x |
A seasonally adjusted model. |
... |
Other parameters passed to |
context |
The optional context used to estimate the model. |
dates |
Parameters used to re-estimate the model (see details). |
init_ggplot() initializes a ggplot2 object by storing the seasonal adjustment model used.
A ggplot2 object that can be further customized.
mod <- rjd3x13::jx13(window(rjd3toolkit::ABS$X0.2.20.10.M, start = 2000)) init_ggplot(mod) + geom_line(color = "#F0B400") + geom_sa(component = "sa", color = "#155692")mod <- rjd3x13::jx13(window(rjd3toolkit::ABS$X0.2.20.10.M, start = 2000)) init_ggplot(mod) + geom_line(color = "#F0B400") + geom_sa(component = "sa", color = "#155692")
A dataset containing on monthly industrial production indices in manufacturing in the European Union (from sts_inpr_m dataset of Eurostat). Data are based 100 in 2015 and are unadjusted, i.e. neither seasonally adjusted nor calendar adjusted.
ipi_c_eu ipi_c_eu_dfipi_c_eu ipi_c_eu_df
A monthly ts object from january 1990 to december 2017 with 34 variables for ipi_c_eu and a data.frame for ipi_c_eu_df.
An object of class data.frame with 360 rows and 35 columns.
The dataset contains 34 time series corresponding to the following geographical area
| BE | Belgium |
| BG | Bulgaria |
| CZ | Czechia |
| DK | Denmark |
| DE | Germany (until 1990 former territory of the FRG) |
| EE | Estonia |
| IE | Ireland |
| EL | Greece |
| ES | Spain |
| FR | France |
| HR | Croatia |
| IT | Italy |
| CY | Cyprus |
| LV | Latvia |
| LT | Lithuania |
| LU | Luxembourg |
| HU | Hungary |
| MT | Malta |
| NL | Netherlands |
| AT | Austria |
| PL | Poland |
| PT | Portugal |
| RO | Romania |
| SI | Slovenia |
| SK | Slovakia |
| FI | Finland |
| SE | Sweden |
| UK | United Kingdom |
| NO | Norway |
| CH | Switzerland |
| ME | Montenegro |
| MK | Former Yugoslav Republic of Macedonia, the |
| RS | Serbia |
| TR | Turkey |
| BA | Bosnia and Herzegovina |
Eurostat
Computes and visualizes the Seasonal-Irregular (SI) ratio from a seasonal adjustment model (X-13 or TRAMO-SEATS).
siratio(x, ...) siratioplot( x, labels = NULL, add = FALSE, box = TRUE, col.s = "darkblue", col.i = "gray", col.mean = "red", cex.i = 0.1, lwd.s = par("lwd"), lwd.mean = lwd.s, main = "SI ratio", xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, ... ) ggsiratioplot( x, labels = NULL, col.s = "darkblue", col.i = "gray", col.mean = "red", cex.i = 0.5, lwd.s = 1, lwd.mean = lwd.s, main = "SI ratio", xlab = NULL, ylab = NULL, ... )siratio(x, ...) siratioplot( x, labels = NULL, add = FALSE, box = TRUE, col.s = "darkblue", col.i = "gray", col.mean = "red", cex.i = 0.1, lwd.s = par("lwd"), lwd.mean = lwd.s, main = "SI ratio", xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, ... ) ggsiratioplot( x, labels = NULL, col.s = "darkblue", col.i = "gray", col.mean = "red", cex.i = 0.5, lwd.s = 1, lwd.mean = lwd.s, main = "SI ratio", xlab = NULL, ylab = NULL, ... )
x |
An input model (X-13 or TRAMO-SEATS) or data object. |
... |
Additional arguments passed to methods or low-level plotting functions. |
labels |
Character vector of labels for the periods (e.g., months or quarters). |
add |
Logical indicating whether the plot should be added to an existing one. |
box |
Logical indicating whether a box should be drawn around the plot. |
col.s, col.i, col.mean
|
Colors for the seasonal component, the SI points, and the mean lines. |
cex.i, lwd.s, lwd.mean
|
Graphical parameters for point size and line widths. |
main, xlab, ylab
|
Character strings for the main title, X-axis label, and Y-axis label. |
xlim, ylim
|
Numeric vectors of length 2 specifying the X and Y axis limits. |
For siratio(): A ts object containing the SI ratio and the seasonal component.
For siratioplot(): Called for its side effects (base 'R' plot).
For ggsiratioplot(): A ggplot2 object representing the SI ratio chart.
x <- rjd3x13::x13(ipi_c_eu[, "FR"]) siratioplot(x) ggsiratioplot(x)x <- rjd3x13::x13(ipi_c_eu[, "FR"]) siratioplot(x) ggsiratioplot(x)
Converts a ts or mts object into a data.frame that can be directly used in plotting functions.
ts2df(x) ## S3 method for class 'ts' ts2df(x) ## S3 method for class 'mts' ts2df(x)ts2df(x) ## S3 method for class 'ts' ts2df(x) ## S3 method for class 'mts' ts2df(x)
x |
A |
A data.frame object.
# To get the ipi_c_eu_df object: ts2df(ipi_c_eu)# To get the ipi_c_eu_df object: ts2df(ipi_c_eu)
Weekly US claims
usclaimsusclaims
An object of class data.frame with 2868 rows and 3 columns.