Welcome to the Time Series Analysis (TSA) module webpage of the ECDC EPIET & EUPHEM Program.
Here you will find the Practical Sessions 3-7, 9 and 10 of the TSA module 2025, including the instructions, guide and solution of the proposed exercises. Sessions 8 and 11 will be provided as stand-alone exercises
Copyright and License
This exercises were originally designed in 2011 for the training needs of EPIET, PAE, NorFETP and Austrian FETP fellows. Many colleagues were involved in updating and maintaining these materials through the years, credit will be displayed soon.
Revisions:
Exercises were reviewed, updated and adapted to this web format for TSA 2025 by Tanja Charles, Sharon Kuhlmann, Soledad Colombe, Joana Gomes and Javier Del Águila
Information and documents made available on ECDC web pages are public and may be reproduced and/or distributed, totally or in part, irrespective of the means and/or the formats used, for non-commercial purposes, provided that ECDC is always acknowledged as the source of the material. Such acknowledgement must be included in each copy of the material. Any reproduction for commercial purposes will require licensing or prior permission. Citations may be made from such material without prior permission, provided the source is always acknowledged. (http://ecdc.europa.eu/en/pages/legalnotice.aspx).
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
Under the following conditions:
Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). The best way to do this is to keep as it is the list of contributors: sources, authors and reviewers.
Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. Your changes must be documented. Under that condition, you are allowed to add your name to the list of contributors.
You cannot sell this work alone, but you can use it as part of a teaching.
With the understanding that:
Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
Other Rights — In no way are any of the following rights affected by the license:
Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
The author’s moral rights;
Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
Notice — For any reuse or distribution, you must make clear to others the license terms of this work by keeping together this work and the current license.
Participants need to have R, RTools, and RStudio installed in their computer. Preferably, the installation of these applications should be done in the stated order: R >> RTools >> RStudio. If you don’t have these applications installed yet, please do so following the instructions below:
R should be installed in the participants’ computer. You can download it from here, on the section “Download and Install R”. Select the adequate version to your computer’s operating system.
Latest version available is 4.5.2 (31st Oct 2025). You don’t need the latest version installed. However, it’s highly recommended to stay updated on at least the ‘major version’ (4.x.x) and not too many ‘minor versions’ (x.5.x) away, as packages tend to update to each of them. A warning message might show when using p_load if your R version is older than a package’s last update; however, it will work fine.
Multiple versions of R can be installed in one’s computer. R usually can be installed without administrative rights. If you have more than one R version installed on your computer, please make sure that you select the specific version 4.2.3. when running RStudio (Top Menu: Settings > Global Options > Left Panel > R)
RTools at the same R version you are using should also be installed in the participants’ computer. You can download the necessary files by clicking here and selecting the corresponding operating system in your computer.
For MacOS, RTools installation comprises the minimal installation of clang and gfortran as listed in the hyperlinked website. Please note that preferably only one version of RTools version 4.2 or below should be installed in one’s computer. RTools version 4.3 can be installed simultaneously with RTools version 4.2. or below in one’s computer.
RStudio can be used with previous versions without creating conflict with packages or R versions safely. Try to keep updated if possible.
Libraries
The following R packages have to be installed. Open RStudio, copy the highlighted code below into the R Console pane and press enter. This process might take several minutes.
Show the code
# Install pacman if not installed already, and activate itif (!require("pacman")) install.packages("pacman")# Install, update and activate librariespacman::p_load( here, rio, skimr, tsibble, ISOweek, slider, pander, season, lmtest, TSA, ciTools, gtsummary, patchwork, AER, MASS, sjPlot, tidyverse)## packages to be installed for outbreak detection / loaded by pacmanpacman::p_load(devtools)devtools::install_github("United4Surveillance/signal-detection-tool")## packages to be installed for multilevel / loaded by pacmanpacman::p_load(devtools)devtools::install_github("goodekat/redres")
Frequent problems you may encounter during the SignalDetectionTool installation:
Please start a new R session before the installation by going in Rstudio to Session
Solution: RStudio menu bar > Session > New Session
In case you get an error message that some package with version x.x.x. is already loaded in the namespace, but a higher version is requested, you should try:
Make a new R session
If 1) did not work, then manually install_packages(package_with_problem).
Install the SignalDetectionTool again
In case you have troubles accessing Github check below
Installation Instructions for the SignalDetectionTool in case of problems with GitHub access
Save the file signal-detection-tool-0.8.0.tar.gz on your computer
Open RStudio and run install.packages("remotes")
Install all dependencies for the SignalDetectionTool by running and filling in your path to the stored .tar.gz with the command remotes::install_deps("your_path_to_signal-detection-tool-0.8.0.tar.gz"
Install the SignalDetectionTool by running install.packages("your_path_to_signal-detection-tool-0.8.0.tar.gz", repos = NULL, type = "source")
Data
To download all neccessary datasets and files for this practicals, click in this link and then save the zip file in the data folder of your project
# Welcome {.unnumbered}{fig-align="center"}Welcome to the **Time Series Analysis** (**TSA**) module webpage of the *ECDC EPIET & EUPHEM* Program.Here you will find the Practical Sessions 3-7, 9 and 10 of the TSA module 2025, including the instructions, guide and solution of the proposed exercises. Sessions 8 and 11 will be provided as stand-alone exercises# Copyright and License {.unnumbered}This exercises were originally designed in 2011 for the training needs of EPIET, PAE, NorFETP and Austrian FETP fellows. Many colleagues were involved in updating and maintaining these materials through the years, credit will be displayed soon.**Revisions**:- Exercises were reviewed, updated and adapted to this web format for TSA 2025 by Tanja Charles, Sharon Kuhlmann, Soledad Colombe, Joana Gomes and Javier Del ÁguilaInformation and documents made available on ECDC web pages are public and may be reproduced and/or distributed, totally or in part, irrespective of the means and/or the formats used, for non-commercial purposes, provided that ECDC is always acknowledged as the source of the material. Such acknowledgement must be included in each copy of the material. Any reproduction for commercial purposes will require licensing or prior permission. Citations may be made from such material without prior permission, provided the source is always acknowledged. (http://ecdc.europa.eu/en/pages/legalnotice.aspx).**You are free:**- **to Share** — to copy, distribute and transmit the work- **to Remix** — to adapt the work**Under the following conditions:**- **Attribution** — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). The best way to do this is to keep as it is the list of contributors: sources, authors and reviewers.- **Share Alike** — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. Your changes must be documented. Under that condition, you are allowed to add your name to the list of contributors.You cannot sell this work alone, but you can use it as part of a teaching.**With the understanding that:**- **Waiver** — Any of the above conditions can be **waived** if you get permission from the copyright holder.- **Public Domain** — Where the work or any of its elements is in the **public domain** under applicable law, that status is in no way affected by the license.- **Other Rights** — In no way are any of the following rights affected by the license: - Your fair dealing or **fair use** rights, or other applicable copyright exceptions and limitations; - The author's **moral** rights; - Rights other persons may have either in the work itself or in how the work is used, such as **publicity** or privacy rights.- **Notice** — For any reuse or distribution, you must make clear to others the license terms of this work by keeping together this work and the current license.**This licence is based on <http://creativecommons.org/licenses/by-sa/3.0/>**# How to prepare for the module {.unnumbered}## Install R, Rtools and Rstudio {.unnumbered}Participants need to have R, RTools, and RStudio installed in their computer. Preferably, the installation of these applications should be done in the stated order: R \>\> RTools \>\> RStudio. If you don’t have these applications installed yet, please do so following the instructions below:- **R** should be installed in the participants’ computer. You can download it from [here](https://cran.r-project.org/), on the section “Download and Install R”. Select the adequate version to your computer’s operating system. - Latest version available is 4.5.2 (31^st^ Oct 2025). [*You don’t need the latest version installed.*]{.underline} However, it’s highly recommended to stay updated on at least the ‘major version’ (4.x.x) and not too many ‘minor versions’ (x.5.x) away, as packages tend to update to each of them. A warning message might show when using p_load if your R version is older than a package’s last update; however, it will work fine. - Multiple versions of R can be installed in one’s computer. R usually can be installed without administrative rights. If you have more than one R version installed on your computer, please make sure that you select the specific version 4.2.3. when running RStudio (Top Menu: Settings \> Global Options \> Left Panel \> R)- **RTools at the same R version you are using** should also be installed in the participants’ computer. You can download the necessary files by clicking [here](https://cloud.r-project.org/bin/windows/Rtools/) and selecting the corresponding operating system in your computer. - For MacOS, RTools installation comprises the minimal installation of clang and gfortran as listed in the hyperlinked website. Please note that preferably only one version of RTools version 4.2 or below should be installed in one’s computer. RTools version 4.3 can be installed simultaneously with RTools version 4.2. or below in one’s computer.- [**RStudio**](https://posit.co/download/rstudio-desktop/) can be used with previous versions without creating conflict with packages or R versions safely. Try to keep updated if possible.## Libraries {.unnumbered}**The following R packages have to be installed**. Open RStudio, copy the highlighted code below into the R Console pane and press enter. [This process might take several minutes.]{.underline}```{r}#| eval: false# Install pacman if not installed already, and activate itif (!require("pacman")) install.packages("pacman")# Install, update and activate librariespacman::p_load( here, rio, skimr, tsibble, ISOweek, slider, pander, season, lmtest, TSA, ciTools, gtsummary, patchwork, AER, MASS, sjPlot, tidyverse)## packages to be installed for outbreak detection / loaded by pacmanpacman::p_load(devtools)devtools::install_github("United4Surveillance/signal-detection-tool")## packages to be installed for multilevel / loaded by pacmanpacman::p_load(devtools)devtools::install_github("goodekat/redres")```**Frequent problems you may encounter during the SignalDetectionTool installation:**- Please start a new R session before the installation by going in Rstudio to Session - [Solution]{.underline}: RStudio menu bar \> Session \> New Session- In case you get an error message that some package with version x.x.x. is already loaded in the namespace, but a higher version is requested, you should try: - Make a new R session - If 1) did not work, then manually install_packages(package_with_problem). - Install the SignalDetectionTool againIn case you have troubles accessing Github check below**Installation Instructions for the SignalDetectionTool in case of problems with GitHub access**1. Save the file signal-detection-tool-0.8.0.tar.gz on your computer2. Open RStudio and run `install.packages("remotes")`3. Install all dependencies for the SignalDetectionTool by running and filling in your path to the stored .tar.gz with the command `remotes::install_deps("your_path_to_signal-detection-tool-0.8.0.tar.gz"`4. Install the SignalDetectionTool by running `install.packages("your_path_to_signal-detection-tool-0.8.0.tar.gz", repos = NULL, type = "source")`## Data To download all neccessary datasets and files for this practicals, click in [this link](https://github.com/EPIET/TimeSeriesAnalysis_2025/raw/refs/heads/main/download%20folder/_all_data_2025.zip) and then save the zip file in the data folder of your project