retro_summary-methods: 'retro_summary'

retro_summaryR Documentation

retro_summary

Description

Performs an exploratory, descriptive analysis of the time series of observed data, for as many syndromic groups as under study, and outputs both a markdown file, where the user can have access to all retrospective analysis R codes, and an html summary (produced by knitting the .Rmd file).

Usage

retro_summary(x, ...)

## S4 method for signature 'syndromicD'
retro_summary(x, object.name = "my.syndromic",
  file.name = "syndromic.retro.summary", frequency = 365, short = FALSE)

## S4 method for signature 'syndromicW'
retro_summary(x, object.name = "my.syndromic",
  file.name = "syndromic.retro.summary", frequency = 52, short = FALSE)

Arguments

x

a syndromic (syndromicD or syndromicW) object, from where dates and observed data will be extracted.

...

Additional arguments to the method.

object.name

a name for the title in the html file, by default "my.syndromic".

file.name

a name for the rmd/html file to be created with the summary. The default is "syndromic.retro.summary". When changing the file name remember to use quotes. Please note that the function will create a subdirectory within the current working directory, where all files will be saved. Make sure to check the current working directory (getwd()) and set a convenient one if needed (setwd()). See examples.

frequency

The cycle of data repetition. By default equal to 365 (year) for objects of the class syndromicD and 52 weeks for objects of the class syndromicW. For DAILY data without weekends, for instance, it should be set to 260.

short

By default set to FALSE. When set to TRUE, omits the fitting of poisson and negative binomial distributions, displaying only summary statistics and plots for each series.

Details

The summary should constitue a first step in the retrospective exploratory analysis of available syndromic data. It is also intended to serve as means to check the result of the creation of an object of the class syndromic (syndromicD or syndromicW). That is, it is a convenient, fast way to plot all syndromic time-series in the object.

If the user wants to make changes to the summary produced, it is easy to open the .Rmd file in RStudio and produce any changes to the R code generated.

Value

A ".Rmd" file and a ".html" page with sections corresponding to each syndromic group found in the slot observed of the syndromic object. These include:

  • daily and weekly plots Line plots of the data found in the slot observed of the syndromic object provided. In the case of daily data, Weekly plots are produced merging the daily data by week.

  • basic summary statistics Such as mean, quartiles, auto-correlation and partial auto-correlation.

  • box-plots of the data by day-of-week, month and year, intended to allow a preliminary assessment of which temporal effects are present (day-of-week, seasonal or trends). Plots vary depending on whether the data provided is monitored daily (syndromicD) or weekly (syndromicW)

  • Poisson model fitting Fitting of a Poisson model to the data using a formula specified by the user.

  • Negative Binomial model fitting Fitting of a negative binomial model to the data using a formula specified by the user.

Examples

data(lab.daily)
my.syndromicD <- raw_to_syndromicD (id=SubmissionID,
                                  syndromes.var=Syndrome,
                                  dates.var=DateofSubmission,
                                  date.format="%d/%m/%Y",
                                  data=lab.daily)
retro_summary(my.syndromicD)


my.syndromicD <- raw_to_syndromicD (id=lab.daily$SubmissionID,
                                 syndromes.var=lab.daily$Syndrome,
                                 dates.var=lab.daily$DateofSubmission,
                                 date.format="%d/%m/%Y")
wd = getwd()
setwd(paste0(wd,"/retro"))
retro_summary(my.syndromicD)
setwd(wd)

### WEEKLY
data(lab.daily)
my.syndromicW <- raw_to_syndromicW (id=SubmissionID,
                                  syndromes.var=Syndrome,
                                  dates.var=DateofSubmission,
                                  date.format="%d/%m/%Y",
                                  data=lab.daily)
retro_summary(my.syndromicW)


my.syndromicW <- raw_to_syndromicW (id=lab.daily$SubmissionID,
                                 syndromes.var=lab.daily$Syndrome,
                                 dates.var=lab.daily$DateofSubmission,
                                 date.format="%d/%m/%Y")
wd = getwd()
setwd(paste0(wd,"/retro"))
retro_summary(my.syndromicW)
setwd(wd)


nandadorea/vetsyn documentation built on April 30, 2022, 1:15 a.m.