Numerically describing the content of data plots is very difficult. These functions are an attempt to measure in the special situation of a lineup, how the true data plot differs or not from the null plots.
Metrics are calculated in association with lineups to help understand what people see in the data plots, and assess the quality of a lineup, because the null plots represent a finite sample from a null distribution, and this finiteness may affect how observers read the lineups.
The distance metrics included in the nullabor package cover some of the types of plots used in the first 10 Turk studies: scatterplots, side-by-side boxplots, regression lines overlaid on scatterplots, and colored scatterplots. A generic approach based on binning the plot space and calculating data density should (roughly) work universally for 2D displays.
When a null-generating method is given the functions can simulate more draws from the null to provide an empirical distribution of the distance values for the null plots. This would be used to guage how far the data plot is to the null plots relative to how far null plots are from each other. This might be used to assess whether the data plot in lineup shuld be detected or not by a human observer.
sep_dist are ways of calculating how different one plot is from another. These are used to get a sense if the actual data plot is different from the null plots, in as far as we can determine numerically. The functions
distplot compute a rough estimate of the distribution of the distance measures for the data and the null generating mechanism, and make a plot where the values for the actual data plot and the null plots in a lineup are shown. This helps a little to evaluate whether we would expect people to easily pick the data plot from the lineup and thus help to organize the setting up and analysing the results from Amazon Turk experiments http://www.public.iastate.edu/~hofmann/experiments.html some.
There are five different distance metrics in nullabor package, named
uni_dist. The different distance metrics are constructed so that they can identify the different properties of the data.
uni_dist works for univariate data while the others works for all types of bivariate data. Binned distance is a generic distance which can be used in any situations while the other distance metrics are constructed so that they can identify the effect of graphical elements in a plot like an overlaid regression line or presence of defined clusters. To calculate some of the metrics, additional informations like a class variable or the number of bins should be provided.
uni_dist is a distance metric which calculates the euclidean distance between the first four central moments of two univariate data. A typical usage would be when one needs to calculate the distance between the two histograms drawn from two datasets.
##  2.196865
reg_dist is a distance metric which calculates the euclidean distance between the regression parameters of a model fitted to one plot and that of another plot. It is advisable to use this distance in situations where a regression line is overlaid on a scatterplot.
##  0.7466127
box_dist is a distance metric which works for side-by-side boxplots with two levels. The first quartile, median and the third quartile are calculated for each box and the absolute distances of these are calculated for the two boxes.
box_dist calculates the euclidean distance between these absolute distances for the two plots. The boxplot distance should be used in situations where a side-by-side boxplot is used to compare the distribution of a variable at two different levels.
##  12.01749
sep_dist is a distance metric based on the separation between clusters. The separation between clusters is defined by the minimum distances of a point in the cluster to a point in another cluster. The separation between the clusters for a given dataset is calculated. An euclidean distance is calculated between the separation for the given dataset and another dataset. The number of clusters in the dataset should be provided. If not, the hierarchical clustering method is used to obtain the clusters.
##  1.76988
bin_dist is a generic distance which works for any situation for any dataset. For a given bivariate dataset, X and Y variables are divided into p and q bins respectively to obtain pq cells. The number of points falling in each cell are counted for a given dataset.
bin_dist between two datasets calculates the euclidean distance between the cell counts of these two data. The values of p and q should be provided as arguments.
##  9.486833
It is interesting to see whether the true plot in a lineup is different from all the null plots. To find this the distances between the true plot and all the null plots are calculated and the mean of these distances is calculated. Similarly, for each null plot, the distance between the null plot and all the other null plots is calculated and averaged to obtain the mean distance for each null plot.
calc_mean_dist calculates the mean distance corresponding to each plot in the lineup. If the mean distance of the true plot is larger than the mean distances of all the null plots, the lineup is considered easy. If one of the null plots has a larger mean distance than the true plot, the lineup is considered difficult.
## # A tibble: 20 x 2 ## plotno mean.dist ## <int> <dbl> ## 1 1 0.0436 ## 2 2 0.273 ## 3 3 0.0824 ## 4 4 0.0527 ## 5 5 0.0441 ## 6 6 0.0495 ## 7 7 0.0635 ## 8 8 0.0419 ## 9 9 0.0412 ## 10 10 0.700 ## 11 11 0.0447 ## 12 12 0.0767 ## 13 13 0.249 ## 14 14 0.114 ## 15 15 0.0412 ## 16 16 0.0551 ## 17 17 0.0414 ## 18 18 0.0491 ## 19 19 0.160 ## 20 20 0.0420
The mean distances for each plot in the lineup are obtained using
calc_diff calculates the difference between the mean distance for the true plot and the maximum mean distance for the null plots.
##  0.6650102
Binned distance is highly affected by the choice of the number of bins. The number of bins is provided by the user and this can be subjective. This motivates to design a way to select the optimum number of bins to be used.
opt_diff finds the optimal number of bins in both x and y direction which should be used to calculate the binned distance. The binned distance is calculated for each combination of provided choices of number of bins in x and y direction and finds the difference using
calc_diff for each combination. The combination for which the difference is maximum should be used.
Measuring the quality of a lineup is interesting. But it may also be important to compare a few lineups. The
distmet function provides the empirical distribution of the distance metrics based on the mean distance of the true plot and the mean distance from the null plots. The lineup data, the null generating mechanism and the choice of the distance metric has to be provided. Users have the flexibility of using their distance metrics. The position of the true plot in the lineup has to be provided as well. If the distance metrics require additional arguments, those have to be provided as well.
Copy and paste the output of lineup.dat to get the position of the true plot
## # A tibble: 6 x 2 ## plotno mean.dist ## <int> <dbl> ## 1 1 0.0356 ## 2 2 0.0375 ## 3 3 0.0569 ## 4 4 0.0259 ## 5 5 0.0270 ## 6 6 0.0353
##  0.6529149
##  13 11 18 16 17
##  0.02329537 0.13616242 0.02569378 0.10654773 0.03266645 0.09358247
##  10
distplot functions plots the empirical distribution of the distance metric, given the output of
distmet function. The distribution is shown in grey along the distance for the true plot in orange and the distances for the null plots in black.
Roy Chowdhury, N. and Cook, D. and Hofmann, H. and Majumder, M. and Zhao, Y. (2014) Utilizing Distance Metrics on Lineups to Examine What People Read From Data Plots, http://arxiv.org/abs/1408.1889.