fwerPowerFdrPower: Simulate FWER, POWER, FDR, and POWER

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

View source: R/fwerPowerFdrPower.R

Description

This function simulate the Family Wise Error Rate (FWER) and the corresponding Power, and the False Discovery Rate (FDR) and the corresponding Power for the different effect sizes

Usage

1
2
3
fwerPowerFdrPower(i, simu, null, corr = 0, cv = 0, alpha = 0.05,
  groupSize = 100, effectType = c("continuous", "binary"),
  covariateEffectVec, datWeightByNull)

Arguments

i

Integer, i-th effect size of a vector of effects

simu

Integer, number of replications

null

Numeric, proportion of the true null hypothesis

corr

Numeric, correlation between the test statistics

cv

Numeric, coefficient of variation of the test statistics

alpha

Numeric value of the significance threshold

groupSize

Integer, number of test statistics per group

effectType

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

covariateEffectVec

A numeric vector of different covariate-effect size

datWeightByNull

A numeric matrix of weights, each column corresponds to an covariate-effect size

Details

This function simulate Family Wise Error Rate (FWER) and corresponding Power, and False Discovery Rate (FDR) and the corresponding Power for the different effect sizes

Value

A matrix of 16 rows containing information about FWER, POWER, FDR, and POWER (4 rows for each item)

Author(s)

Mohamad S. Hasan, shakilmohamad7@gmail.com

References

Hasan and Schliekelman (2017)

See Also

weight_byEffect_cont ranksProb_byEffect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# vector of covariate-effect sizes
covariateEffectVec <- c(1, 1.5, 2)

# compute probability matrix
ranksProb_byEffect <- sapply(1:length(covariateEffectVec), ranksProb_byEffect,
             null = .9, m = 100, covariateEffectVec = covariateEffectVec)

# compute weights
weightByEffect <- sapply(1:length(covariateEffectVec), weight_byEffect_cont,
                   alpha = .05, null = .9, m = 100, delInterval = .01,
                   covariateEffectVec = covariateEffectVec,
                   datByNull = ranksProb_byEffect)

simuVal = 3  # in the actual case use at least simVal = 1000
result <- sapply(1:length(covariateEffectVec), fwerPowerFdrPower, simu = simuVal,
             null = .5, corr = 0, cv = 0, alpha = .05, groupSize = 100,
             effectType = "continuous", covariateEffectVec = covariateEffectVec,
             datWeightByNull = weightByEffect)

mshasan/OPWpaper1 documentation built on Feb. 22, 2021, 10:22 a.m.