Skip to content

This repository contains the code to reproduce the simulation study in the paper "Assessing systematic changes in measurements across a data collection: A simulation study".

Notifications You must be signed in to change notification settings

bips-hb/sys-measurement-changes

Repository files navigation

Systematic measurement changes: A simulation study

This repository contains the code to reproduce the simulation study in the paper
“Assessing systematic measurement changes in single-wave study data: A simulation study”.

The study compares seven statistical methods for quantifying systematic changes in a sequence of measurements across different settings:

  • Autoregressive integrated moving average (ARIMA)
  • Fused lasso signal approximator (FLSA)
  • Generalized additive model (GAM)
  • Locally weighted scatterplot smoothing (LOWESS)
  • Moving average (MA)
  • Pruned exact linear time (PELT)
  • Piecewise regression (PR)

The simulation results can be interactively explored via an accompanying Shiny application. The source code for the app is available in a separate GitHub repository.

📁 Repository structure

  • functions/: Contains function definitions for 01_simulation_study.R:
  • renv/: Contains project-specific environment configuration files.
  • results/: Contains all outputs of the simulation study, including figures, tables, and supplementary data. Raw results are stored in res.rds.
  • 01_simulation_study.R: Runs the simulation study using the batchtools R package. Results are saved in res.rds
  • 02_visualizations.R: Generates figures and tables for the main manuscript and supplementary_data_1.pdf.
  • 03_supplementary_data_2.R: Creates the supplementary Excel file supplementary_data_2.xlsx containing bias and mean squared error for different settings.
  • 04_supplementary_data_3.Rmd: R Markdown to create supplementary_data_3.pdf with the output from the Shiny application.
  • renv.lock: Records package versions.

🚀 Reproducing the results

To reproduce the simulation study, run 01_simulation_study.R. This executes the simulations and saves the results to results/res.rds.

To recreate the figures and tables for the main manuscript and supplementary_data_1.pdf, run 02_visualizations.R. This saves the figures and supplementary figures under results/figures and the tables under results/tables.

To recreate the supplementary files supplementary_data_2.xlsx and supplementary_data_3.pdf, run 03_supplementary_data_2.R and 04_supplementary_data_3.Rmd, respectively.

Note: It is not necessary to run the simulation study to create the figures, tables, or supplementary data, as the results are already stored in results/res.rds.

📚 R environment

This project uses the renv R package to ensure reproducible R environments. The exact package versions used for the simulation study are recorded in renv.lock. To restore the environment and install all required packages:

1. Clone the repository

Clone the repository (or download the ZIP) to save renv.lock locally.

2. Open the project

Open the project in R (e.g. in RStudio). Make sure renv.lock is in the project root directory.

3. Install renv

Install renv if not already installed.

install.packages("renv")

4. Restore project library

Restore the project library using renv.lock

renv::restore()

About

This repository contains the code to reproduce the simulation study in the paper "Assessing systematic changes in measurements across a data collection: A simulation study".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors