TimeseriesProcessingPipeline: General timeseries processing

Description Super classes Methods

Description

General timeseries processing

General timeseries processing

Super classes

ukcovidtools::PassthroughFilesystemCache -> ukcovidtools::DataProvider -> ukcovidtools::CovidTimeseriesProvider -> TimeseriesProcessingPipeline

Methods

Public methods

Inherited methods

Method new()

Usage
TimeseriesProcessingPipeline$new(providerController, ...)

Method incidenceFromCumulative()

Usage
TimeseriesProcessingPipeline$incidenceFromCumulative(covidTimeseries, ...)

Method cumulativeFromIncidence()

Usage
TimeseriesProcessingPipeline$cumulativeFromIncidence(covidTimeseries, ...)

Method aggregateRagged()

Usage
TimeseriesProcessingPipeline$aggregateRagged(
  groupedDf,
  originalVar,
  aggregateVars,
  ...,
  fn = sum,
  dateVar = "date",
  valueVars = vars(value)
)

Method aggregateAge()

Usage
TimeseriesProcessingPipeline$aggregateAge(covidTimeseries, fn = sum, ...)

Method aggregateGender()

Usage
TimeseriesProcessingPipeline$aggregateGender(covidTimeseries, fn = sum, ...)

Method aggregateSubgroup()

Usage
TimeseriesProcessingPipeline$aggregateSubgroup(covidTimeseries, fn = sum, ...)

Method aggregateSource()

Usage
TimeseriesProcessingPipeline$aggregateSource(
  covidTimeseries,
  namedListOfSources = list(`All sources` = unique(covidTimeseries$source)),
  fn = sum,
  ...
)

Method aggregateGeography()

Usage
TimeseriesProcessingPipeline$aggregateGeography(
  covidTimeseries,
  targetCodeTypes,
  completeness = "source",
  fn = sum,
  ...
)
Arguments
completeness

should the mapping be complete? if the mapping is "source" complete it will only be successful if all source codes are present when mapping to a higher region. if the mapping is target, then only if all the target codes are represented. Or both if the mapping must be complete at both ends.


Method imputeAndWeeklyAverage()

Usage
TimeseriesProcessingPipeline$imputeAndWeeklyAverage(
  covidTimeseries,
  window = 7,
  ...
)

Method removeZeroDays()

Usage
TimeseriesProcessingPipeline$removeZeroDays(r0Timeseries, valueVar = "value")

Method completeAndRemoveAnomalies()

Usage
TimeseriesProcessingPipeline$completeAndRemoveAnomalies(
  r0Timeseries,
  outlier_min = 10,
  outlier_sd = 5,
  window = 9,
  valueVar = "value",
  originalValueVar = "value.original",
  precision = 1e-05,
  allowZeroDays = FALSE
)

Method smoothAndSlopeTimeseries()

Calculate an estimate of rate of change of Rt using a loess

Usage
TimeseriesProcessingPipeline$smoothAndSlopeTimeseries(
  r0Timeseries,
  smoothExpr,
  ...,
  window = 14,
  leftSided = TRUE
)
Arguments
R0timeseries

a grouped df contianing R0 timeseries including a date and a 'Median(R)' column from EpiEstim


Method logIncidenceStats()

Usage
TimeseriesProcessingPipeline$logIncidenceStats(
  covidTimeseries,
  valueVar = "value",
  growthRateWindow = 7,
  smoothingWindow = 14,
  earliestPossibleDate = "2020-02-01",
  ...
)

Method estimateGrowthRate()

Usage
TimeseriesProcessingPipeline$estimateGrowthRate(
  covidTimeseries,
  window = 14,
  growthRateWindow = 7,
  leftSided = TRUE,
  ...
)

Method estimateGrowthRate2()

Usage
TimeseriesProcessingPipeline$estimateGrowthRate2(
  covidTimeseries,
  window = 21,
  weekendEffect = 0.75,
  ...
)

Method estimateRtQuick()

Calculates a survival R(t) curve on grouped data

Usage
TimeseriesProcessingPipeline$estimateRtQuick(
  covidTimeseries,
  valueVar = "RollMean.value",
  window = 7,
  ...
)
Arguments
covidTimeseries

a covid timeseries data frame

valueVar

- the column to calculate an R(t) for - usually "RollMean.value"

window

- the width of the smoothing function applied (default 2)

config

An object of class estimate_R_config, as returned by function EpiEstim::make_config.

Returns

a dataframe with groupwise Rt estimates


Method estimateRt()

Calculates a survival R(t) curve on grouped data

Usage
TimeseriesProcessingPipeline$estimateRt(
  covidTimeseries,
  valueVar = "RollMean.value",
  window = 7,
  priorR0 = 1,
  priorR0Sd = 2,
  quick = FALSE,
  serialIntervalProvider = self$serial,
  ...
)
Arguments
covidTimeseries

a covid timeseries data frame

valueVar

- the column to calculate an R(t) for - usually "RollMean.value"

window

- the width of the smoothing function applied (default 7)

config

An object of class estimate_R_config, as returned by function EpiEstim::make_config.

dateVar

- the variable containing the seqence of dates

incidenceVar

- the sequence of daily incidence

Returns

a dataframe with groupwise Rt estimates


Method defaultOffsetAssumptions()

Usage
TimeseriesProcessingPipeline$defaultOffsetAssumptions()

Method defaultCorrectionFactor()

Usage
TimeseriesProcessingPipeline$defaultCorrectionFactor()

Method defaultR0Assumptions()

Usage
TimeseriesProcessingPipeline$defaultR0Assumptions()

Method adjustRtConfidence()

Usage
TimeseriesProcessingPipeline$adjustRtConfidence(
  covidRtResult,
  sdMultiplier,
  predicate = NULL
)

Method adjustRtDates()

Usage
TimeseriesProcessingPipeline$adjustRtDates(
  covidRtResult,
  window = 0,
  offsetAssumptions = self$defaultOffsetAssumptions(),
  extraCols = NULL
)

Method adjustGrowthRateDates()

Usage
TimeseriesProcessingPipeline$adjustGrowthRateDates(
  covidRtResult,
  window = 0,
  offsetAssumptions = self$defaultOffsetAssumptions(),
  extraCols = NULL
)

Method adjustRtCorrFac()

Usage
TimeseriesProcessingPipeline$adjustRtCorrFac(
  covidRtResult,
  window = 7,
  correctionFactor = self$defaultCorrectionFactor(),
  extraCols = NULL
)

Method estimateRtWithAssumptions()

Usage
TimeseriesProcessingPipeline$estimateRtWithAssumptions(
  covidTimeseries,
  valueVar = "RollMean.value",
  window = 7,
  period = 28,
  quick = FALSE,
  r0Assumptions = self$defaultR0Assumptions(),
  serialIntervalProvider = self$serial,
  dateRange = as.Date(c(min(covidTimeseries$date), max(covidTimeseries$date)),
    "1970-01-01"),
  ...
)

Method estimateVolatilty()

calculate a volatility statistic for the timeseries based on previous N days

Usage
TimeseriesProcessingPipeline$estimateVolatilty(
  covidTimeseries,
  valueVar,
  outputVar = NULL,
  window = 28
)
Arguments
valueVar

- value for which the volatility being calculated

window

- The number of time points to consider

df

a df containing a timeseries

Details

This will not work well for timeseries with NAs

$x+y=z$


Method plotRt()

Plot the EpiEstim output in a standard way

Usage
TimeseriesProcessingPipeline$plotRt(
  covidRtTimeseries,
  colour = NULL,
  events = self$datasets$getSignificantDates(1),
  rtlim = c(0.5, 2.5),
  dates = NULL,
  jepidemicMode = any(self$jepidemicCols %in% colnames(covidRtTimeseries)),
  ribbons = TRUE,
  ...
)
Arguments
rtlim

- the max and min or Rt to display

dates

- the min (and optionally max) dates to display as a YYYY-MM-DD character (or anything that can be coerced to a Date)

df

a df containing an Rt timeseries, including a date and a 'Median(R)' column from EpiEstim

group

- the colour aesthetic

dateVar

- the name of the date column

facetVars

- the facetting variables

features

-


Method plotGrowthRate()

Plot the growth rate

Usage
TimeseriesProcessingPipeline$plotGrowthRate(
  covidRtTimeseries,
  colour = NULL,
  events = self$datasets$getSignificantDates(1),
  rlim = c(-0.25, 0.25),
  dates = NULL,
  ribbons = TRUE,
  growthVar = "Growth.value",
  growthLowerVar = "Growth.Quantile.0.025.value",
  growthHigherVar = "Growth.Quantile.0.975.value",
  growthSEVar = NULL,
  ...
)
Arguments
colour

- the colour aesthetic

rlim

- the max and min or Rt to display

dates

- the min (and optionally max) dates to display as a YYYY-MM-DD character (or anything that can be coerced to a Date)

ribbons

- display the confidence limit as ribbons

df

a df containing an Rt timeseries, including a date and a 'Median(R)' column from EpiEstim


Method plotGrowthIncidence()

Usage
TimeseriesProcessingPipeline$plotGrowthIncidence(
  groupedCovidRtTimeseries,
  plotDates = NULL,
  timespan = 15,
  colour = NULL,
  populationAdj = TRUE,
  showConfInt = TRUE,
  showHistorical = TRUE,
  maxAlpha = 0.6,
  rlim = c(-0.15, 0.15),
  ilim = c(0, NA),
  maxSize = 6,
  ...
)

Method gogPlot()

Usage
TimeseriesProcessingPipeline$gogPlot(...)

Method plotEvents()

Usage
TimeseriesProcessingPipeline$plotEvents(
  events,
  labelSize = 7,
  labelY = Inf,
  ...
)

Method plotDefault()

Usage
TimeseriesProcessingPipeline$plotDefault(
  data,
  events = NULL,
  dates = NULL,
  ylim = NULL,
  labelSize = 7,
  ...
)

Method plotIncidenceQuantiles()

Usage
TimeseriesProcessingPipeline$plotIncidenceQuantiles(
  covidTimeseries,
  denominatorExpr = NULL,
  colour = NULL,
  events = self$datasets$getSignificantDates(1),
  dates = NULL,
  ribbons = TRUE,
  ylim = c(0, NA),
  ...
)

Method plotIncidenceRollmean()

Usage
TimeseriesProcessingPipeline$plotIncidenceRollmean(
  covidTimeseries,
  denominatorExpr = NULL,
  events = self$datasets$getSignificantDates(1),
  dates = NULL,
  ylim = c(0, NA),
  ...
)

Method clone()

The objects of this class are cloneable with this method.

Usage
TimeseriesProcessingPipeline$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


terminological/uk-covid-datatools documentation built on June 24, 2021, 8:16 p.m.