Description Usage Arguments Examples
View source: R/geom_diagnostics.R
Adds a table of diagnostics to the plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
mapping |
Set of aesthetic mappings created by aes() or
aes_(). If specified and |
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 layer(). These are
often aesthetics, used to set an aesthetic to a fixed value, like
|
method |
the method used for the seasonal adjustment. |
spec |
the specification used for the seasonal adjustment. See x13() or tramoseats(). |
frequency |
the frequency of the time series. By default ( |
message |
a |
diagnostics |
vector of character containing the name of the diagnostics to plot. See user_defined_variables() for the available parameters. |
digits |
integer indicating the number of decimal places to be used for numeric diagnostics. By default |
xmin, xmax |
x location (in data coordinates) giving horizontal location of raster. |
ymin, ymax |
y location (in data coordinates) giving vertical location of raster. |
table_theme |
list of theme parameters for the table of diagnostics (see ttheme_default()). |
inherit.aes |
If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 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 of diagnostics with result of the X-11 combined test and the p-values
# of the residual seasonality qs and f tests:
diagnostics <- c("diagnostics.combined.all.summary", "diagnostics.qs", "diagnostics.ftest")
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.combined.all.summary",
`Residual qs-test (p-value)` = "diagnostics.qs",
`Residual f-test (p-value)` = "diagnostics.ftest")
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.