# weight_binary: Weight for the Binary effect sizes In mshasan/OPWeight: Optimal p-value weighting with independent information

## Description

Compute weight from the probability of the rank given the effect size for the binary effect size

## Usage

 `1` ```weight_binary(alpha, et, m, m1, tail = 1L, delInterval = 0.001, ranksProb) ```

## Arguments

 `alpha` Numeric, significance level of the hypothesis test `et` Numeric, mean effect size of the test statistics `m` Integer, totoal number of hypothesis test `m1` Integer, number of true alternative hypothesis `tail` Integer (1 or 2), right-tailed or two-tailed hypothesis test. default is right-tailed test. `delInterval` Numeric, interval between the `delta` values of a sequence. Note that, `delta` is a LaGrange multiplier, necessary to normalize the weight `ranksProb` Numeric vector of the ranks probability of the tests given the effect size

## Details

If one wants to test

H_0: epsilon_i=0 vs. H_a: epsilon_i = epsilon,

then `et` and `ey` should be median or any discrete value of the test and covariate effect sizes, respectively. This is called hypothesis testing for the Binary effect sizes. `m1` can be estimated using `qvalue` from a bioconductor package `qvalue`.

## Value

`weight` Numeric vector of normalized weight of the tests for the binary case

## Author(s)

`prob_rank_givenEffect` `weight_continuous` `qvalue`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```# 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 prob2 <- sapply(ranks, prob_rank_givenEffect, et = 2, ey = 1, nrep = 10000, m0 = 50, m1 = 50) # plot the prooabbility plot(ranks, prob2) # compute weight for the binary case weight_bin <- weight_binary(alpha = .05, et = 1, m = 100, m1 = 50, tail=1, delInterval = .0001, ranksProb = prob2) # plot the weight plot(ranks, weight_bin) ```