bin_permute_best: bin_permute_best

Usage Arguments Examples

View source: R/bin_permute_best.R

Usage

1
bin_permute_best(variable, testdata, top_pm, zoomn, alpha = 0.05, psigalpha = 0.05, method = "kruskal", goodtype = "goodpvname", initial_fun = bin_true_initial, test_fun = bin_multitest, exchange_fun = bin_exchange, paral = "yes")

Arguments

variable
testdata
top_pm
zoomn
alpha
psigalpha
method
goodtype
initial_fun
test_fun
exchange_fun
paral

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (variable, testdata, top_pm, zoomn, alpha = 0.05, psigalpha = 0.05, 
    method = "kruskal", goodtype = "goodpvname", initial_fun = bin_true_initial, 
    test_fun = bin_multitest, exchange_fun = bin_exchange, paral = "yes") 
{
    trueinitial <- initial_fun(variable = variable, testdata = testdata, 
        top_pm = top_pm, method = method, goodtype = goodtype)
    select <- trueinitial$select
    selname <- trueinitial$selname
    position0 <- trueinitial$position0
    position1 <- trueinitial$position1
    levs <- trueinitial$levs
    n <- trueinitial$n
    N <- trueinitial$N
    testlevel <- trueinitial$testlevel
    psig0 <- sum(!trueinitial$otu.test$pv > psigalpha, na.rm = T)
    pvalue0 <- -log10(trueinitial$otu.test$pv[select])
    effectsize0 <- trueinitial$otu.test$es
    effectsize0 <- effectsize0[select]
    out <- exchange_fun(k = n, top_pm = top_pm, n = n, zoomn = zoomn, 
        variable = variable, select = select, selname = selname, 
        testdata = testdata, testlevel = testlevel, levs = levs, 
        position0 = position0, position1 = position1, alpha = alpha, 
        psigalpha = psigalpha, method = method, test_fun = test_fun, 
        paral = paral)
    goodpsigname <- selname[!(out[["psigdist"]][, "q1"] <= psig0 & 
        psig0 <= out[["psigdist"]][, "q2"])]
    goodpvname <- selname[!(out[["pvdist"]][, "q1"] <= pvalue0 & 
        pvalue0 <= out[["pvdist"]][, "q2"])]
    goodesname <- selname[!(out[["esdist"]][, "q1"] <= effectsize0 & 
        effectsize0 <= out[["esdist"]][, "q2"])]
    return(list(psig0 = psig0, pvalue0 = pvalue0, effectsize0 = effectsize0, 
        selname = selname, worst_case = out, goodpsigname = goodpsigname, 
        goodpvname = goodpvname, goodesname = goodesname))
  }

LyonsZhang/ProgPerm documentation built on July 16, 2020, 12:45 a.m.