weight_binary_nwt: Weight for the binary effect sizes

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/weight_binary_nwt.R

Description

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

Usage

1
weight_binary_nwt(alpha, m1, et, ranksProb, x0 = NULL)

Arguments

alpha

Numeric, significance level of the hypothesis test

m1

Integer, number of true alternative hypothesis

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 = epsilon,

then 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 weight_binary 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 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 value of lambda

Author(s)

Mohamad S. Hasan, sha[email protected]

See Also

prob_rank_givenEffect weight_binary

Examples

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)

mshasan/OPWeight documentation built on Aug. 22, 2017, 4:09 p.m.