Learn R Programming

tsgc (version 0.0)

plot_gy_ci: Plots the growth rates and slope of the log cumulative growth rate

Description

Plots the smoothed/filtered growth rate of the difference in the cumulated variable (\(g_y\)) and the associated confidence intervals.

Usage

plot_gy_ci(
  res,
  plt.start.date = NULL,
  smoothed = FALSE,
  title = NULL,
  series.name = NULL,
  pad.right = NULL
)

Value

A ggplot2 plot.

Arguments

res

Results object estimated using the estimate() method.

plt.start.date

Plot start date. Default is NULL which is the start of the estimation sample.

smoothed

Logical value indicating whether to used the smoothed estimates of \(\delta\) and \(\gamma\). Default is FALSE, in which case the filtered estimates are returned.

title

Title for plot. Enter as text string. NULL (i.e. no title) by default.

series.name

The name of the series the growth rate is being computed for. E.g. 'New cases'.

pad.right

Numerical value for the amount of time periods of blank space you wish to leave on the right of the graph. Extends the horizontal axis by the given number of time periods.

Examples

Run this code
library(tsgc)
data(gauteng,package="tsgc")
idx.est <- zoo::index(gauteng) <= as.Date("2020-07-20")

# Specify a model
model <- SSModelDynamicGompertz$new(Y = gauteng[idx.est], q = 0.005)
# Estimate a specified model
res <- model$estimate()

# Plot filtered gy, g and gamma
plot_gy_ci(res, plt.start.date = as.Date("2020-07-13"))

Run the code above in your browser using DataLab