Plot predictions along with truth

plot_trajectory(
  predictions_cards,
  geo_type = c("county", "hrr", "msa", "dma", "state", "hhs", "nation"),
  intervals = c(0.5, 0.8, 0.95),
  plot_it = TRUE,
  show_geo_value = NULL,
  show_forecaster = NULL,
  side_truth = NULL,
  show_points = TRUE,
  show_quantiles = TRUE,
  nrow = NULL,
  ncol = NULL,
  ...
)

Arguments

predictions_cards

long data frame of forecasts with a class of predictions_cards as created by get_predictions() or get_zoltar_predictions() or get_covidhub_predictions(). The first 4 columns are the same as those returned by the forecaster. The remainder specify the prediction task, 10 columns in total: ahead, geo_value, quantile, value, forecaster, forecast_date, data_source, signal, target_end_date, and incidence_period. Here data_source and signal correspond to the response variable only.

geo_type

String indicating geographical type, such as "county", or "state". See the COVIDcast Geographic Coding documentation for available options.

intervals

vector of confidence intervals to show. More than 3 is ugly and will be reduced to the default set.

plot_it

should we actually produce the figure. If you have many geo_values or forecasters, best not to. Then you can assign the output to an object and facet or apply aesthetic specifications to meet your own standards.

show_geo_value

a subset of geo_values in your predictions_cards. Default uses all available. If you only want to see some, this may speed up the call.

show_forecaster

a subset of forecasters in your predictions_cards. Default uses all available. If you only want to see some, this may speed up the call.

side_truth

optional. Use your own truth data rather than downloading with covidcast::covidcast_signal(). Must contain columns geo_value, value and target_end_date

show_points

do you want points as well as lines

show_quantiles

do you want to plot the quantiles or just lines

nrow

the number of rows present in the output plot. Similarly, ncol adjusts the number of columns. Only one of nrow and ncol may be set and they only have an effect if a plot is actually produced. Additionally, If data is present for multiple forecasters, any output plot is faceted, so nrow and ncol cannot be set.

ncol

See nrow

...

additional arguments passed to covidcast::covidcast_signal() or as.predictions_cards

Value

invisibly returns a ggplot object