Skip to contents

P-value function: Cauchy Combined Indepence Test

Usage

pCombCauchyDist(
  dat,
  fmla = YcontNorm ~ trtF | blockF,
  simthresh = 20,
  sims = 1000,
  parallel = "no",
  ncpu = NULL,
  distfn = fast_dists_and_trans_hybrid
)

Arguments

dat

An object inheriting from class data.frame

fmla

A formula appropriate to the function. Here it should be something like outcome~treatment|block

simthresh

is the size of the data below which we use direct permutations for p-values

sims

Either NULL (meaning use an asymptotic reference dist) or a number (meaning sampling from the randomization distribution implied by the formula)

parallel

is "no" then parallelization is not required, otherwise it is "multicore" or "snow" in the call to coin::independence_test() (see help for coin::approximate()). Also, if parallel is not "no" and adaptive_dist_function is TRUE, then an openmp version of the distance creation function is called using ncpu threads (or parallel::detectCores(logical=FALSE) cores).

ncpu

is number of cpus to be used for parallel operation.

distfn

is a function that produces one or more vectors (a data frame or matrix) of the same number of rows as the dat. Leave it at fast_dists_and_trans_hybrid, which returns the five transformed scores in the order the function assigns them; until 0.0.4.1013 the default was fast_dists_and_trans_nomax_hybrid, which left out the maximum distance.

Value

A p-value

Details

This function combines seven p-values by the Cauchy combination rule of Liu and Xie (2020). Six come from testing one score at a time: (1) the raw outcome, (2) each unit's mean Euclidean distance to the other units in its block, (3) the same mean distance computed on within-block ranks, (4) each unit's maximum distance to another unit in its block, (5) the within-block rank of the outcome, and (6) the tanh transform of the raw outcome, which is more sensitive when there is skew. The seventh is the quadratic (Hotelling-style) test of all six scores together, the same statistic that pIndepDist() tests, so that a signal visible only in how the scores move together still reaches the sum. The scores are the six that fast_dists_and_trans_hybrid() returns, computed within block when the formula carries a block. Any score that is constant is dropped. Inspired by Rizzo and Szekely's work on Euclidean distance based testing and by Hansen and Bowers (2008) on omnibus tests.