weight_by_delta: Find sum of weights for the LaGrange multiplier

Description Usage Arguments Details Value Author(s) Examples

View source: R/weight_by_delta.R

Description

Compute sum of weights for a given value of the LaGrange multiplier

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
weight_by_delta(
  delta,
  alpha = 0.05,
  et,
  m,
  m1,
  tail = 1L,
  ranksProb,
  effectType = c("continuous", "binary")
)

Arguments

delta

Numeric value of the LagRange multiplier

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 tests

tail

Integer (1 or 2), right-tailed or two-tailed hypothesis test. default is right-tailed test.

ranksProb

Numeric vector of the ranks probability of the covariate statistics given the effect size

effectType

Character ("continuous" or "binary"), type of effect sizes

Details

To obtain the normalized weight, and to make sure that the sum of the weights is equal to the number of tests and the weights are positive, an optimal value of the LaGrange multiplier delta needed. This function will compute the weights for a given value of the LaGrange multiplier and provide the sum of the weights in return.

Value

sumWeight_per_delta sum of weights per delta value

Author(s)

Mohamad S. Hasan, shakilmohamad7@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# generate a sequence of delta
delta <- seq(0, 1, .0001)

# compute probability fiven effect
covariates = runif(100, min = 0, max = 2.5)
probs <- dnorm(covariates, mean = 0, sd = 1)

# compute the sum of weights for each delta
weightSum_by_delta <- sapply(delta, weight_by_delta, m = 100, m1 = 50, et = 2,
                            ranksProb = probs, effectType = "continuous")

mshasan/OPWeight documentation built on March 3, 2021, 12:41 a.m.