expected_plot: Plot Expected Counts

View source: R/expected_plot.R

expected_plotR Documentation

Plot Expected Counts

Description

Check if expected counts fit data

Usage

expected_plot(
  expected,
  title = "",
  start = NULL,
  end = NULL,
  ylim = NULL,
  weekly = FALSE,
  color = "#3366FF",
  alpha = 0.5
)

Arguments

expected

The output from 'compute_expected'

title

A title to add to plot

start

First day to show

end

Last day to show

ylim

A vector with two numbers that determines the kimits for the y-axis

weekly

Logical that determines if data should be summarized into weekly counts

color

Color for the expected curve

alpha

alpha blending for points

Value

A ggplot object containing a plot of the original counts and the estimated expected values.

Examples

data(new_jersey_counts)
exclude_dates <- as.Date("2012-10-29") + 0:180
e <- compute_expected(new_jersey_counts, exclude = exclude_dates, weekday.effect = TRUE)

library(ggplot2)
expected_plot(e, start = as.Date("2012-09-01"), end = as.Date("2013-09-01"))


excessmort documentation built on May 29, 2024, 1:17 a.m.