calc_diff: Calculating the difference between true plot and the null...

Description Usage Arguments Value Examples

View source: R/opt_diff.r

Description

Distance metric is used to calculate the mean distance between the true plot and all the null plots in a lineup. The difference between the mean distance of the true plot and the maximum mean distance of the null plots is calculated.

Usage

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

Arguments

lineup.dat

lineup data to get the lineup

var

a vector of names of the variables to be used to calculate the difference

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

difference between the mean distance of the true plot and the maximum mean distance of the null plots

Examples

1
2
3
4
5
6
7
8
if(require('dplyr')){
lineup.dat <- lineup(null_permute('mpg'), mtcars, pos = 1)
calc_diff(lineup.dat, var = c('mpg', 'wt'), met = 'bin_dist',
dist.arg = list(lineup.dat = lineup.dat, X.bin = 5, Y.bin = 5), pos = 1, m = 8)}

if(require('dplyr')){
calc_diff(lineup(null_permute('mpg'), mtcars, pos = 1), var = c('mpg', 'wt'), met = 'reg_dist',
dist.arg = NULL, pos = 1, m = 8)}

nullabor documentation built on Feb. 26, 2020, 1:07 a.m.