# prob_rank_givenEffect_approx: Probability of rank of test given effect size by normal... In mshasan/OPWeight: Optimal p-value weighting with independent information

## Description

A normal approximation to comnpute the probability of rank of a test being higher than any other test given the effect size from external information.

## Usage

 ```1 2``` ```prob_rank_givenEffect_approx(k, et, ey, nrep = 10000, m0, m1, effectType = c("binary", "continuous")) ```

## Arguments

 `k` Integer, rank of a test `et` Numeric, effect of the targeted test for importance sampling `ey` Numeric, mean/median covariate efffect from external information `nrep` Integer, number of replications for importance sampling `m0` Integer, number of true null hypothesis `m1` Integer, number of true alternative hypothesis `effectType` Character ("continuous" or "binary"), type of effect sizes

## Details

If one wants to test

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

then `ey` should be mean of the covariate effect sizes, This is called hypothesis testing for the continuous effect sizes.

If one wants to test

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

then `ey` should be median or any discrete value of the covariate effect sizes. This is called hypothesis testing for the Binary effect sizes.

`m1` and `m0` can be estimated using `qvalue` from a bioconductor package `qvalue`.

## Value

`prob` Numeric, probability of the rank of a test

## Author(s)

`dnorm` `pnorm` `rnorm` `qvalue`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```# compute the probability of the rank of a test being third if all tests are # from the true null prob <- prob_rank_givenEffect(k = 3, et = 0, ey = 0, nrep = 10000, m0 = 50, m1 = 50) # 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) # plot plot(ranks,prob) ```