This is a Newton Raphson based algorithm to compute weight from the ranks probability for the binary effect sizes.
Numeric, significance level of the hypothesis test
Integer, number of true alternative hypothesis
Numeric, mean effect size of the test statistics
Numeric vector of ranks probability of the tests given the effect size
Numeric, a initial value for the Newton-Raphson mehod.
If one wants to test
H_0: epsilon_i = 0 vs. H_a: ε_i = epsilon,
et should be median of the test effect sizes.
This is called hypothesis testing for the binary effect sizes.
For the Newton-Raphson mehthod the initial value
x0 is very important.
One may need to supply externally if the function shows error. Newton-Raphson
method may not work in some cases. In that situations, use
function, which is a general but slow approach to compute weights beased on the
grid search algorithm.
w Numeric vector of weights of the tests for the binary case
lambda Numeric value of the LaGrange multiplier
n Integer, number of iteration needed to obtain the initial value
k Integer, number of iteration needed to obtain the optimal
Mohamad S. Hasan, [email protected]
1 2 3 4 5 6 7 8 9
# compute the probabilities of the ranks of a test being rank 1 to 100 if the # targeted test effect is 2 and the overall mean covariate effect is 1. ranks <- 1:100 prob <- sapply(ranks, prob_rank_givenEffect, et = 2, ey = 1, nrep = 10000, m0 = 50, m1 = 50) # compute weight for the binary case results = weight_binary_nwt(alpha = .05, m1 = 50, et = 2, ranksProb = prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.