power.ranksum: Compute power of the rank-sum test

Description Usage Arguments Details Value References Examples

View source: R/fdr-sampsize-v1.0e.R

Description

Compute power of rank-sum test;Uses formula of Noether (JASA 1987)

Usage

1
power.ranksum (n, alpha, p) 

Arguments

n

sample size (scalar)

alpha

p-value threshold (scalar)

p

Pr (Y>X), as in Noether (JASA 1987)

Details

In most applications, the null effect size will be designated by p = 0.5, which indicates that Thus, in the example below, the argument null.effect=0.5 is specified in the call to fdr.sampsize.

Value

vector of power estimates for two-sided tests

References

Noether, Gottfried E (1987) Sample size determination for some common nonparametric tests. Journal of the American Statistical Association, 82:645-647.

Examples

1
2
3
4
5
6
7
 power.ranksum        # show the power function
 res=fdr.sampsize(fdr=0.1,
                  ave.pow=0.8,
                  pow.func=power.ranksum,
                  eff.size=rep(c(0.8,0.5),c(100,900)),
                  null.effect=0.5)
 res

Example output

function (n, alpha, p) 
{
    mu0 = 0.5 * n * n
    mu1 = p * n * n
    delta = (mu1 - mu0)
    sig2 = n * n * (2 * n + 1)/12
    sig = sqrt(sig2)
    z.reject = -abs(qnorm(alpha/2, 0, sig))
    pow = pnorm(z.reject, delta, sig) + pnorm(-z.reject, delta, 
        sig, lower.tail = F)
    return(pow)
}
<environment: namespace:FDRsampsize>
           n        alpha      ave.pow      fdr.hat      act.fdr 
23.000000000  0.008178711  0.800080047  0.084272149  0.084250168 

FDRsampsize documentation built on May 2, 2019, 9:14 a.m.