For each synthetic row, computes the ratio of its distance to the nearest real row vs. its distance to the second-nearest real row. A high ratio (close to 1) means the synthetic row is not unusually close to any specific real row — low disclosure risk. Score = mean(ratio > 0.5).
Details
By default columns are z-scored using the real-data mean and standard deviation before the Euclidean distance is computed; without this, a single large-scale column (e.g. income in dollars) dominates the distance and the score becomes a function of measurement units rather than of similarity.
Examples
real <- data.frame(x = rnorm(50), y = rnorm(50))
syn <- data.frame(x = rnorm(50), y = rnorm(50))
nndr(real, syn)
#> [1] 0.84