Distance metric is used to calculate the mean distance between the true plot and all the null plots in a lineup. The mean distances of each null plot to all the other null plots are calculated. The mean distances are returned for all the plots in the lineup.

calc_mean_dist(lineup.dat, var, met, pos, dist.arg = NULL, m = 20)

Arguments

lineup.dat

lineup data of the lineup

var

a vector of names of the variables to be used to calculate the mean distances

met

distance metric needed to calculate the distance as a character

pos

position of the true plot in the lineup

dist.arg

a list or vector of inputs for the distance metric met; NULL by default

m

number of plots in the lineup, by default m = 20

Value

the mean distances of each plot in the lineup

Examples

if(require('dplyr')){ calc_mean_dist(lineup(null_permute('mpg'), mtcars, pos = 1), var = c('mpg', 'wt'), met = 'reg_dist', pos = 1)}
#> # A tibble: 20 x 2 #> plotno mean.dist #> <int> <dbl> #> 1 1 0.737 #> 2 2 0.0209 #> 3 3 0.0210 #> 4 4 0.0299 #> 5 5 0.0337 #> 6 6 0.0510 #> 7 7 0.0312 #> 8 8 0.0614 #> 9 9 0.0434 #> 10 10 0.0245 #> 11 11 0.0230 #> 12 12 0.0242 #> 13 13 0.0318 #> 14 14 0.0289 #> 15 15 0.0464 #> 16 16 0.0747 #> 17 17 0.0331 #> 18 18 0.0257 #> 19 19 0.0250 #> 20 20 0.162