Skip to contents

[Stable]

This function generates a complete 'ggplot' object suitable for visualizing time series data in an aedseo_tsd object. It creates a line plot connecting the observations and adds points at each data point.

Usage

autoplot(object, ...)

# S3 method for aedseo_tsd
autoplot(object, ...)

# S3 method for aedseo
autoplot(object, linewidth = 0.7, size = 2, alpha = 0.3, width = 0.2, ...)

Arguments

object

An aedseo_tsd or aedseo object

...

Additional arguments (not used).

linewidth

Numeric, the width of the line for the growth rate

size

Numeric, size of observational points.

alpha

Numeric, the alpha (transparency) for the observations with a significantly positive growth rate.

width

Numeric, the width of the error bar employed to show the confidence interval of the growth rate estimate.

Value

A 'ggplot' object for visualizing the time series data.

Examples

# Create an example aedseo_tsd object
aedseo_tsd_object <- tsd(
  observed = c(100, 120, 150, 180, 220, 270),
  time = as.Date(c(
    "2023-01-01",
    "2023-01-02",
    "2023-01-03",
    "2023-01-04",
    "2023-01-05",
    "2023-01-06"
  )),
  time_interval = "day"
)

# Create a ggplot visualization for the aedseo_tsd object
autoplot(aedseo_tsd_object)


# Create an aedseo object
aedseo_object <- aedseo(
  tsd = aedseo_tsd_object,
  k = 3,
  level = 0.95,
  family = "quasipoisson"
)

# Create a ggplot visualization of growth rates with confidence intervals
autoplot(aedseo_object, linewidth = 1, alpha = 0.2)

#> Warning: Using alpha for a discrete variable is not advised.