Run several tests of independence on a benchmark of different functional relationships

Share:

Description

This function runs a set of independence tests on a benchmark consisting of different functional dependence types (see generate.benchmark.data)

Usage

1
run.tests(fun, args, types, noises, size = 320, nsim = 500, ...)

Arguments

fun

function or character naming a function. A function should have two vectors of coordinates as first two arguments

args

list of additional arguments to the functions fun. If a function does not need any arguments use an empty list.

types

numeric, which type of dependence to benchmark (see generate.benchmark.data)

noises

matrix of noise to add to each dependence. It should have types number of columns

size

numeric, size of the data sets to generate (default 320 points)

nsim

numeric, how many replicate simulations to run under the null model and H1, default 500

...

additional arguments to pass on to function generate.benchmark.data

Details

This function makes use of mclapply so MC_CORES should be set to a number greater than 1 for parallelization

Value

This function returns a list data structure that can be further processed with the functions of this package, calculate.power,generate.roc

Author(s)

Sebastian D├╝mcke duemcke@mpipz.mpg.de

See Also

calculate.power,generate.roc, generate.benchmark.data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
noises = cbind(lin=c(.1,.5,.8),circ=c(.2,.4,.6))
mycor = function(...) cor(...)^2
results.cor=run.tests(mycor,args=list(),types=c(1,7),noises=noises,nsim=50,size=100)
results = run.tests("novelTest.extreme",args=list(maxi=10),types=c(1,7),noises=noises,nsim=25,
	size=100)
## Not run: 
x11()
par(mfrow=c(1,ncol(noises)))
roc.plot(generate.roc(results,pval=FALSE),legend=noises)

## End(Not run)
power = t(drop(calculate.power(results,.95,`>`)))
power.cor = t(drop(calculate.power(results.cor,.95,`>`)))
#cor is excellent at linear relationships, not so much for circular relationships:
#(increasing power is an artifact of low number of simulation, increase nsim in run.tests)
power.plot(list(cor=power.cor, novelTest=power),noises,show.legend="topright",mains=c("Linear", 
	"Circle"))