arima_ciplot: arima_ciplot This uses the output from 'run_arima' to create...

View source: R/arima-spikes-onegeo.R

arima_ciplotR Documentation

arima_ciplot This uses the output from run_arima to create a figure showing the confidence interval of the ARIMA

Description

arima_ciplot This uses the output from run_arima to create a figure showing the confidence interval of the ARIMA

Usage

arima_ciplot(
  df,
  geo = "US",
  title = NULL,
  xlab = "Date",
  xfmt = date_format("%b %Y"),
  ylab = "Greater Than Expected (%)",
  ylim = NULL,
  outfn = "./output/fig.pdf",
  vlinelwd = 1,
  vlinecol = "grey74",
  beginplot = T,
  endplot = T,
  hline = T,
  vline = T,
  lbreak = "1 month",
  hicol = NA,
  locol = NA,
  nucol = NA,
  opcol = NA,
  colorscheme = "red",
  polyalpha = 0.9,
  interrupt,
  width = 6,
  height = 3,
  lwd = 0.3,
  save = T,
  extend = F
)

Arguments

df

The dataframe as outputted by run_arima.

geo

The column name of the geography of searches that you want.

title

The title of the figure. The default is no title.

xlab

The label for the x axis

ylab

The label for the y axis

ylim

length-2 vector with ymin and ymax, Default NULL

outfn

Where to save the plot.

beginplot

The date you want the plot to start

endplot

The date you want the plot to end.

lbreak

The distance between tick marks in the x axis, i.e., "one year" or "3 month"

interrupt

The date of the interruption (should be the same as run_arima)

width

Width of the plot in inches

height

Height of the plot in inches

lwd

Line width

save

Default is True. If False, the plot is not saved.

linelabel

Label next to the vertical interruption line

Examples

arima_plot(
           df,
           title = "Searches to Purchase Cigarettes - US",
           xlab = "Date",
           ylab = "Query Fraction",
           outfn = './output/fig.pdf',
           beginplot = "2019-09-01",
           endplot = "2020-01-15",
           lbreak = "1 year",
           linelabel = "Tobacco 21 Signed",
           interrupt = ymd("2019-12-19"),
           width = 6,
           height = 3,
           lwd = 0.3,
           save = T
           )

tlcaputi/gtrendR documentation built on Nov. 3, 2022, 10:46 p.m.