geom_arima {ggdemetra}R Documentation

ARIMA model

Description

Function to add directly to the plot the ARIMA model used in the pre-adjustment process of the seasonal adjustment.

Usage

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
)

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

A data.frame that contains the data used for the seasonal adjustment.

stat

The statistical transformation to use on the data for this layer, as a string.

geom

character. The geometric to use to display the data: GeomText (geom = "text", the default, see geom_text()) or GeomLabel (geom = "label", see geom_label()).

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3.

method

the method used for the seasonal adjustment. "x13" (by default) for the X-13ARIMA method and "tramoseats" for TRAMO-SEATS.

spec

the specification used for the seasonal adjustment. See x13() or tramoseats().

frequency

the frequency of the time series. By default (frequency = NULL), the frequency is computed automatically.

message

a boolean indicating if a message is printed with the frequency used.

x_arima, y_arima

position of the text of the ARIMA model. By default, the first position of the data is used.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them.

Details

With the parameter geom = "text", the ARIMA model 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 ARIMA model, making it easier to read.

Examples

p_sa_ipi_fr <- ggplot(data = ipi_c_eu_df, mapping = aes(x = date, y = FR)) +
    geom_line(color =  "#F0B400") +
    labs(title = "Seasonal adjustment of the French industrial production index",
         x = "time", y = NULL) +
    geom_sa(color = "#155692", 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)          

[Package ggdemetra version 0.2.8 Index]