FORECASTplot: Create a plot of the sampled curves and forecasts

View source: R/Plot.R

FORECASTplotR Documentation

Create a plot of the sampled curves and forecasts

Description

This function is used to create a plot of simultaneous confidence bands.

Usage

FORECASTplot(
  modeldata,
  model_res,
  forecast_res,
  ncol,
  targetdata = NULL,
  legend = TRUE
)

Arguments

modeldata

The long-format data frame/table of virus concentration

model_res

The fitted model from WWmodel()

ncol

The number of columns in the plot

targetdata

The “future” observations to be forecasted (the default is NULL)

legend

If a lengend should be included (the default is TRUE)

Value

The plot of simultaneous confidence bands.

Examples

rawdata = as.data.table(readRDS("ww-db-2021-09-10.rds"))
modeldata = DataPrep(rawdata, "N1")
targetdata = modeldata[date < as.Date("2021-06-15") & date > as.Date("2021-05-15")]
modeldata = modeldata[date <= as.Date("2021-05-15")]

ID = c("Location", "target", "replicate")
date = "date"
value = "log10.value.raw"
covariate = c("dinflvol", "temp")
model_res = WWmodel(modeldata, ID, date, value, covariate, 5000, 2500)

forecast_res = WWforecast(20, modeldata, model_res, ID, date, value, covariate, 5000, 2500)
FORECASTplot(modeldata, model_res, forecast_res, 4, targetdata)

xiaotiand/WWmodel documentation built on May 15, 2023, 6:58 a.m.