MockDataLab

Relational synthetic data generator

Real experiments produce several linked tables, not one: cells and sweeps, patients and visits, plates and wells. Define each table, link them with foreign keys, and write any column as a formula of other columns, its parent rows or aggregates of its child rows, plus a stack of noise. Everything runs in your browser and the same seed always rebuilds the same data.

  • • One-to-many and many-to-many (junction) tables, with row counts per parent that can depend on the parent row.
  • • Formulas like boltzmann(V, parent.V_half, parent.k), mean(sweeps.G) or lag(y, 1).
  • • Stackable noise: Gaussian, log-normal, heteroscedastic, Poisson, clipping, quantization, drift, outliers, MCAR and MAR missingness.
  • • Exports: CSV ZIP, JSON, SQLite with foreign keys, schema.json, and an equivalent pandas script.

Build your schema

Your edits are saved in this browser only. Custom schemas never get a public URL; share them as schema.json.

The relational generator loads as it scrolls into view…

Presets: common multi-level experimental designs

Each preset page explains the data structure, the pitfalls that come with it and the usual analysis, and opens the generator with that schema.

  • Neuroscience & Physiology

    Electrophysiology (patch clamp)

    cells (12) → sweeps (13 per cell) → points (20 per sweep); cells → fits (1 per cell)

    Activation curves are the textbook case where raw points, exclusions and fitted parameters must stay linked; journals increasingly ask for that source data.

    Open the electrophysiology (patch clamp) preset
  • Clinical Medicine & Epidemiology

    Clinical trial (RCT)

    patients (120) → visits (6) → labs (3 analytes); patients → adverse_events (Poisson, arm-dependent)

    Subject / visit / finding / event tables (as in CDISC SDTM) are the most requested structure for teaching mixed models, missing data and safety summaries.

    Open the clinical trial (rct) preset
  • Pharmacology & Drug Discovery

    Dose–response plates

    plates (6) → wells (30 per plate) → readouts (2 per well)

    IC50/EC50 estimation from plates is the bread-and-butter assay in pharmacology and the standard example of technical versus biological replication.

    Open the dose–response plates preset
  • Materials Science & Mechanical Engineering

    Materials tensile test

    specimens (10) → load_steps (60) → strain (2 channels)

    Stress–strain curves per specimen are the canonical repeated-measures structure in engineering labs and a frequent student exercise (modulus, 0.2 % offset yield).

    Open the materials tensile test preset
  • Behavioural Neuroscience

    Mouse behaviour

    mice (24, 4 per cage) → sessions (8 days) → trials (20)

    Animal behaviour has three nested levels (animal, session, trial) plus a housing factor: the canonical setting for pseudoreplication and GLMMs.

    Open the mouse behaviour preset
  • Molecular Biology

    qPCR (ΔΔCt)

    plates (3) → samples (8 per plate) → reactions (2 genes × 3 technical replicates)

    ΔΔCt from qPCR plates is one of the most common analyses in biology papers and the textbook case of technical replicates mistaken for biological ones.

    Open the qpcr (δδct) preset
  • Ecology & Environmental Science

    Field ecology counts

    sites (8) → plots (5) → counts (6 species)

    Nested site/plot designs with overdispersed, zero-heavy counts are the standard case for GLMMs in ecology and the most common reason Poisson models fail there.

    Open the field ecology counts preset
  • Education & Social Science

    Schools / classes / students

    schools (20) → classes (2–4) → students (Poisson ≈ 22, 10–32)

    Students in classes in schools is the original hierarchical linear model example (Raudenbush & Bryk) and still the most taught multilevel structure.

    Open the schools / classes / students preset
  • Data Science & Online Experiments

    A/B test analytics

    experiments (4) ⟷ exposures ⟷ users (1 500); users → sessions (Poisson 3) → events (Poisson, duration-dependent)

    Experimentation data is the most common relational dataset in industry data science, and it needs a many-to-many link that most fake-data tools cannot express.

    Open the a/b test analytics preset
  • Chemistry & Chemical Engineering

    Chemical kinetics

    runs (12) → timepoints (15)

    Concentration–time curves per run at several temperatures are the standard physical-chemistry lab and the classic two-stage estimation problem (k per run, then Ea).

    Open the chemical kinetics preset
  • Agronomy & Plant Science

    Split-plot field trial

    blocks (4) → main_plots (3 irrigation levels) → sub_plots (4 varieties) → quadrats (3)

    Split-plot and RCBD designs dominate agricultural and plant-science field trials and are routinely mis-analysed as completely randomized factorials.

    Open the split-plot field trial preset
  • Engineering & Industrial Data

    IoT sensor readings

    machines (6) → sensors (3 types) → readings (288 per sensor)

    Sensor time series grouped by asset are the standard input for anomaly detection and predictive maintenance, where realistic artefacts matter more than the clean signal.

    Open the iot sensor readings preset

Formula language reference

Formulas use + - * / ^ %, comparisons (== != < > <= >=), && || and strings in quotes. Refer to a column of the same row by name, to the parent row with parent.column, to any ancestor with table.column, and to child rows through an aggregate. k is the row number inside its parent group, row the row number in the table. The parser is a small purpose-built interpreter: there is no access to JavaScript objects.

Scientific models

boltzmann(V, V_half, k)
1 / (1 + exp((V_half − V) / k)) — channel activation
hill(x, EC50, n[, bottom, top])
bottom + (top − bottom) / (1 + (EC50 / x)^n) — 4PL dose response
michaelis(S, Vmax, Km)
Vmax·S / (Km + S) — enzyme kinetics
exp_decay(t, A, tau[, c])
A·exp(−t / tau) + c
sigmoid(x)
1 / (1 + e^−x)
logit(p)
ln(p / (1 − p))
logistic(x, L, k, x0)
L / (1 + exp(−k (x − x0))) — growth curve
arrhenius(T, A, Ea)
A·exp(−Ea / (R·T)), Ea in J/mol, T in K
gompertz(t, A, mu, lambda)
Zwietering growth: A·exp(−exp(mu·e/A·(lambda − t) + 1))

Across tables and rows

lag(col[, n, default])
Value n rows earlier within the same parent group
mean(child.col)
Mean over child rows
sum(child.col)
Sum over child rows
sd(child.col)
Sample SD over child rows
median(child.col)
Median over child rows
count(child)
Number of child rows

Randomness and random effects

rnorm(mean, sd)
Normal draw
runif(min, max)
Uniform draw
rbern(p)
Bernoulli 0/1 draw
rpois(lambda)
Poisson draw
rgamma(shape, scale)
Gamma draw
choice("a", "b", …)
Uniform pick
group_effect(key, sd)
Random effect N(0, sd) shared by all rows with the same key (random intercept)

Logic and missing values

if(cond, a, b)
a when cond is true, else b
is_missing(x)
1 when x is missing
coalesce(a, b, …)
First non-missing value
level(col)
0-based index of a categorical value in its level list

Math

sin(x)
Sine (radians)
cos(x)
Cosine (radians)
tan(x)
Tangent
asin(x)
Arcsine
acos(x)
Arccosine
atan(x)
Arctangent
atan2(y, x)
Two-argument arctangent
tanh(x)
Hyperbolic tangent
exp(x)
e^x
log(x[, base])
Natural log, or log to a base
ln(x)
Natural log
log10(x)
Base-10 log
log2(x)
Base-2 log
sqrt(x)
Square root
abs(x)
Absolute value
sign(x)
Sign (−1, 0, 1)
floor(x)
Round down
ceil(x)
Round up
round(x[, digits])
Round
min(a, b, …)
Minimum (or minimum over child rows)
max(a, b, …)
Maximum (or maximum over child rows)
pow(x, y)
x^y
hypot(x, y)
√(x²+y²)
mod(a, b)
Remainder, always ≥ 0 for b > 0
clamp(x, lo, hi)
Limit x to [lo, hi]

Noise steps

  • Additive Gaussian + N(0, σ)
  • Multiplicative log-normal × e^N(0, σ)
  • Heteroscedastic + N(0, cv·|y|)
  • Poisson counting ~ Pois(y)
  • Clip / saturation
  • Quantize (ADC step)
  • Baseline drift (per row in group)
  • Outliers (p, scale·SD)
  • Missing completely at random (MCAR)
  • Missing if condition (MAR)
  • Round to digits

Steps apply in order, so gaussian → clip models a saturating detector and clip → gaussian does not.

How generation works

Every table's row counts and every column are nodes in one dependency graph. A topological sort decides the order, so parents are created before children and aggregates run after the rows they summarize. A loop such as a = b + 1, b = a * 2 is reported with the full chain of columns. Each column draws from its own random stream derived from the global seed, so editing one column never changes another.

What the relation check shows

For any table you can plot one column against another, read the correlation matrix, and see how the noisy column compares with its noise-free formula value. Numeric constants in a formula are re-estimated by least squares from the generated data, which tells you whether the relation you specified is still recoverable at your sample size and noise level.