Learn R Programming

tsgc (version 0.0)

plot_gy_components: 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\)), the smoothed/filtered growth rate of the the cumulated variable (\(g\)), and the smoothed/filtered slope of \(\ln(g)\), \(\gamma\). Following Harvey and Kattuman (2021), we compute \(g_{y,t}\) as $$g_{y,t} = \exp(\delta_t) + \gamma_t.$$

Usage

plot_gy_components(res, plt.start.date = NULL, smoothed = FALSE, title = 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.

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_components(res, plt.start.date = as.Date("2020-07-06"))

Run the code above in your browser using DataLab