A Simple-to-Use R Package for Mimicking Study Data by Simulations

  SFX Search  Permissions and Reprints Abstract

Background Data protection policies might prohibit the transfer of existing study data to interested research groups. To overcome legal restrictions, simulated data can be transferred that mimic the structure but are different from the existing study data.

Objectives The aim of this work is to introduce the simple-to-use R package Mock Data Generation (modgo) that may be used for simulating data from existing study data for continuous, ordinal categorical, and dichotomous variables.

Methods The core is to combine rank inverse normal transformation with the calculation of a correlation matrix for all variables. Data can then be simulated from a multivariate normal and transferred back to the original scale of the variables. Unique features of modgo are that it allows to change the correlation between variables, to perform perturbation analysis, to handle multicenter data, and to change inclusion/exclusion criteria by selecting specific values of one or a set of variables. Simulation studies on real data demonstrate the validity and flexibility of modgo.

Results modgo mimicked the structure of the original study data. Results of modgo were similar with those from two other existing packages in standard simulation scenarios. modgo's flexibility was demonstrated on several expansions.

Conclusion The R package modgo is useful when existing study data may not be shared. Its perturbation expansion permits to simulate truly anonymized subjects. The expansion to multicenter studies can be used for validating prediction models. Additional expansions can support the unraveling of associations even in large study data and can be useful in power calculations.

Keywords data privacy - perturbation analysis - statistical disclosure control - synthetic data - validation study Data Availability Statement

All relevant data are within the manuscript and its Supporting Information files.


Code Availability (Software Application or Custom Code)

All code including the R package is available as [Supplementary Material].


Authors' Contribution

G. K. was involved in programming and writing, editing, and review of original draft. F. O. was involved in methodology, programming, and writing, editing, and review of the original draft. A. Z. was involved in methodology, supervision, and writing, editing, and review of the original draft.


Authors are listed alphabetically.


Publication History

Received: 07 July 2022

Accepted: 15 February 2023

Accepted Manuscript online:
07 March 2023

Article published online:
11 April 2023

© 2023. The Author(s). This is an open access article published by Thieme under the terms of the Creative Commons Attribution-NonDerivative-NonCommercial License, permitting copying and reproduction so long as the original work is given appropriate credit. Contents may not be used for commercial purposes, or adapted, remixed, transformed or built upon. (https://creativecommons.org/licenses/by-nc-nd/4.0/)

Georg Thieme Verlag KG
Rüdigerstraße 14, 70469 Stuttgart, Germany

留言 (0)

沒有登入
gif