How to compare similarity between two data frames in r? Plot
I have 3 data frames, each containing 2 variables: Gap and relative velocity.

What I want to do
I want to estimate the "similarity" between the observed and calibrated data sets, as well as the observed and menneni data sets. What can I use as a "similarity" measure? If a distance is to be used, should I find it between every point pair and then sum it?
 A: For 1D problems the most popular approach is the Kolmogorov–Smirnov test, implemented as ks.test in R. The Kolmogorov–Smirnov statistic is effectively a measure of similarity between empirical distributions. There are apparently 2D versions; I can't comment on their effectiveness, though. Since you data doesn't show obvious diagonal structure, you could just apply the 1D test separately to each of the 2 dimensions.
A: If you prefer distance way, for your purpose, you can directly compute two new distance(i.e. Euclidean distance) variable to each record(row) and then run ordinary t-test to test whether the variable of distance between menneni and observed is higher than the variable of distance between calibrated and observed. If so, you can claim that calibrated values are a little better.
Code example:
# fake data
observed <- data.frame(X=rnorm(100,mean=1),Y=rnorm(100,mean=0.5))
calibrated <- data.frame(X=observed$X + rnorm(100,sd=0.1),Y = observed$Y + rnorm(100,sd=0.1))
menneni  <- data.frame(X=observed$X + rnorm(100,sd=0.5),Y = observed$Y + rnorm(100,sd=0.2))
# compute two distance variable using Euclidean distance
calibrated.distance <- sqrt(apply((observed - calibrated)^2,1,sum))
menneni.distance <- sqrt(apply((observed - menneni)^2,1,sum))
# run ordinary t-test
t.test(menneni.distance, calibrated.distance, alternative = "greater")

output:
Welch Two Sample t-test

data:  menneni.distance and calibrated.distance
t = 10.968, df = 107.05, p-value < 2.2e-16
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
  0.2885161       Inf
sample estimates:
  mean of x mean of y 
0.4655457 0.1256040 

So in this example, since that menneni.distance is higher calibrated.distance is very significant, I can claim that calibrated values are a little better.
