1 | mcpPV(pv, alpha = 0.05, opt = 1)
|
pv |
|
alpha |
|
opt |
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ##---- 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 (pv, alpha = 0.05, opt = 1)
{
K = length(pv)
pick = NULL
v = order(pv)
ic = 0
for (i in K:1) {
flag = TRUE
if (opt == 1) {
i2 = i * 2
if (i == K)
res = (0 - 2) * sum(log(pv))
if (i < K)
res = (0 - 2) * sum(log(pv[-pick]))
pvF = 1 - pchisq(res, i2)
}
if (opt == 2) {
if (i == K)
res = sum(qnorm(pv/2)^2)
if (i < K)
res = sum(qnorm(pv[-pick]/2)^2)
pvF = 1 - pchisq(res, i)
}
if (opt == 3) {
if (i == K)
res = max(pv)
if (i < K)
res = max(pv[-pick])
pvF = pbeta(res, i, 1)
}
if (pvF > alpha)
flag = TRUE
if (pvF <= alpha/(K + 1 - i)) {
ic = ic + 1
pick = c(pick, v[ic])
flag = FALSE
if (pv[v[ic]] > alpha)
flag = TRUE
}
if (flag)
break
}
Decision = rep("Not Sig", length(pv))
if (!is.null(pick))
Decision[pick] = "Reject"
nsig = sum(length(pick))
list(p.values = pv, Decisions = as.matrix(Decision), num.sig = nsig)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.