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

## Description

This is a Newton Raphson based algorithm to compute weight from the ranks probability for the continuous effect sizes.

## Usage

 `1` ```weight_continuous_nwt(alpha, et, ranksProb, x0 = NULL) ```

## Arguments

 `alpha` Numeric, significance level of the hypothesis test `et` Numeric, mean effect size of the test statistics `ranksProb` Numeric vector of ranks probability of the tests given the effect size `x0` Numeric, a initial value for the Newton-Raphson mehod.

## Details

If one wants to test

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

then `et` should be mean of the test effect sizes. This is called hypothesis testing for the continuous 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 `weight_continuous` function, which is a general but slow approach to compute weights beased on the grid search algorithm.

## Value

`w` Numeric vector of weights of the tests for the continuous 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 value of `lambda`

## Author(s)

`prob_rank_givenEffect` `weight_continuous`
 ```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 continuous case results = weight_continuous_nwt(alpha = .05, et = 2, ranksProb = prob) ```