Configuring Relationships

A synthetic dataset is only useful if it preserves the relationships between variables -- not just each variable's individual distribution. The module captures two kinds of relationship: correlations (the linear association structure) and effect sizes (the standardised measures researchers report and test).


The correlation matrix

When you upload raw data, the module computes a full correlation matrix automatically. The method depends on the pair of variable types involved.

Pearson correlation -- continuous, binary, and time-to-event variables

For every pair of continuous, binary, or time-to-event variables, the module computes the Pearson correlation coefficient from the complete (non-missing) pairs:

r = sum((xi - x_mean)(yi - y_mean)) / sqrt(sum(xi - x_mean)^2 * sum(yi - y_mean)^2)
  • The diagonal is set to 1
  • The matrix is symmetric (only the upper triangle is computed, then mirrored)
  • A pair with fewer than 2 complete observations is assigned correlation 0

Cramer's V -- categorical variables

For every pair of categorical variables, association is measured with Cramer's V:

Cramer's V = sqrt(chi2 / (n * min(rows - 1, columns - 1)))

where chi2 is the Pearson chi-square statistic from the contingency table, n is the number of paired observations, and min(rows-1, columns-1) is the smaller dimension minus one. Cramer's V ranges from 0 (no association) to 1 (perfect association).

Reviewing and editing the matrix

The detected correlation matrix is shown in the Correlation Matrix panel during configuration. You can:

  • Review every pairwise value
  • Manually edit any correlation to a target value you want the synthetic data to reproduce
  • Use the matrix as-is if you simply want to mirror the source

This is the structure the generation engine reproduces via Cholesky decomposition.


Effect sizes

Correlations capture linear association, but researchers usually report and test effect sizes. The module computes five effect-size types automatically, choosing the right one for each pair of variable types.

Effect size Computed for Measures
Correlation Continuous x continuous Linear association strength
Cohen's d Continuous x binary (or categorical group) Standardised mean difference between two groups
Odds Ratio Binary x binary Association between two binary variables
Cramer's V Categorical x categorical Association between two categorical variables
Hazard Ratio Time-to-event x binary Relative hazard between two groups

Cohen's d

For a continuous variable split by a binary grouping variable:

pooled SD = sqrt(((n0 - 1) * sd0^2 + (n1 - 1) * sd1^2) / (n0 + n1 - 2))
Cohen's d = |mean1 - mean0| / pooled SD

The module records per-group means, SDs, and sample sizes alongside the d value.

Odds Ratio

For two binary variables forming a 2x2 table with cells a, b, c, d:

Odds Ratio = (a * d) / (b * c)

Interpretation:

Odds Ratio Label
> 3 Strong positive association
1.5 -- 3 Moderate positive association
0.67 -- 1.5 Weak or no association
0.33 -- 0.67 Moderate negative association
< 0.33 Strong negative association

Hazard Ratio

For a time-to-event variable split by a binary group, the module uses a mean-time-based approximation:

Hazard Ratio = mean_time(group 0) / mean_time(group 1)

Under an exponential survival model, the hazard is the reciprocal of the mean, so the ratio of mean times gives the hazard ratio between groups.

Interpretation:

Hazard Ratio Label
> 2 Strong increased hazard
1.5 -- 2 Moderate increased hazard
0.67 -- 1.5 Similar hazard
0.5 -- 0.67 Moderate decreased hazard
< 0.5 Strong decreased hazard

Cramer's V (as an effect size)

Computed the same way as in the correlation matrix -- from the contingency table and chi-square -- but here treated as the effect size for a categorical x categorical pair.

Correlation (as an effect size)

For a continuous x continuous pair, the Pearson correlation coefficient itself serves as the effect size.


The effect-size matrix

All detected effect sizes are presented in the Effect Size Matrix panel. For each pair of variables it shows:

  • The effect-size type chosen for that pair (based on variable types)
  • The computed value from your source data
  • A short description (e.g. "Cohen's d: 0.62, Mean diff: 4.30" or "Odds Ratio: 2.15")
  • The target value at your chosen sample size

The matrix is the configuration surface for which relationships the synthetic data should preserve. The generation engine treats these as targets, and the validation report shows how closely each was reproduced.


Bounds mode -- how strictly targets are enforced

The bounds mode controls how tightly the engine must reproduce each effect size:

Mode Behaviour
Flexible (default) Each target must be reproduced within a tolerance band (approximately +/-15%). Gives the engine room to satisfy all relationships simultaneously and produces stable, natural-looking data.
Strict The engine aims to reproduce each target as exactly as possible with much tighter tolerance. Use when an exact match to a specific effect size is essential.

The default is flexible, which balances fidelity against the practical difficulty of hitting many targets at once. With many interrelated variables, strict mode can be harder to satisfy; flexible mode is recommended unless you require exact reproduction.


How relationships flow into generation

The configuration handed to the generation engine consists of:

  • The selected variables and their distributions
  • The correlation matrix (linear association structure)
  • The effect sizes (standardised association targets)
  • The bounds mode (how tightly to enforce targets)
  • The sample size (how many synthetic rows to produce)

The engine then generates data that simultaneously satisfies the marginal distributions, the correlation structure, and the effect-size targets.