View source: R/arima-spike-multigeo.R
state_arima_spaghetti | R Documentation |
state_arima_spaghetti: Use the output of state_arima to create a state-level spaghetti plot of differences between the ARIMA model and actual searches
state_arima_spaghetti( state_arima_list, beginplot, endplot, interrupt = NA, ylim = NULL, title = NULL, xlab = "Date", ylab = "Actual Versus Model-Fitted\nSearch Queries (% Diff.)", linelabel = "Interruption", lbreak = "1 week", lwd = 0.4, right_margin = 0.1, xfmt = date_format("%d %b"), states_with_labels = c("CA", "NY", "US", "IL", "TX"), states_to_exclude = c(), hicol = NA, locol = NA, nucol = NA, opcol = NA, colorscheme = "red", spaghettialpha = 0.25, extend = F, save = T, width = 6, height = 4, outfn = "./output/fig.png" )
state_arima_list |
A dataframe including time as |
beginplot |
When the plot begins |
endplot |
When the plot ends |
interrupt |
The date where things change. ARIMA will be predicted on all days before the interrupt. |
ylim |
A 2-item vector for the limits of the y axis |
title |
Title of the figure |
xlab |
x-axis label, default is "Date" |
ylab |
y-axis label, default is "Actual Versus Model-Fitted Search Queries (Pct Diff.)" |
linelabel |
label next to interruption line |
lbreak |
space between tick marks on x axis |
lwd |
line width |
xfmt |
date format for x axis |
states_with_labels |
vector of states that you want to have labels |
states_to_exclude |
vector of states not to include in the figure |
save |
default T, if false does not save |
width |
width in inches |
height |
height in inches |
outfn |
output filename |
state_arima_spaghetti( state_list, interrupt = "2019-03-01", title = NULL, xlab = "Date", ylab = "Actual Versus Model-Fitted Search Queries (Pct Diff.)", data = read.csv("./temp/data.csv", header = T, stringsAsFactor = F), linelabel = "COVID-19 Outbreak", lbreak = "1 week", lwd = 0.4, beginplot = ymd("2019-03-01")-(7*1), endplot = ymd("2019-03-18"), states_with_labels = c("CA", "NY", "US", "IA"), states_to_exclude = c("IA"), save = T, width = 6, height = 4, outfn = "./output/fig.png" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.