powerNicqTest: Power or Sample Size for Non-inferiority Control Quantile...

Description Usage Arguments Details Value See Also Examples

View source: R/nicqFunctions.R

Description

Function gives power (if n1=NULL) or sample size (if power=NULL). Assumes no ties.

Usage

1
2
3
4
5
powerNicqTest(n1 = NULL, n2 = NULL, power = NULL, 
    sig.level = 0.025, n2.over.n1 = 1, q = 0.2, 
    delta0 = 0.1, alternative = c("less", "greater"), 
    gnull = nimDiffOR, galt = function(x){x}, 
    minn=5, maxn = 10^5, ...)

Arguments

n1

sample size of control group, calculated if NULL

n2

sample size of test group. If n1=NULL, n2 is ignored and calculated based on power and n2.over.n1. If power=NULL, then n2=ceiling(n2.over.n1*n1).

power

power under galt, calculated if NULL

sig.level

significance level

n2.over.n1

ratio of sample sizes

q

probability associated with control quantile of interest

delta0

difference in proportions at control quantile of interest

alternative

alternative hypothesis direction, 'less' means F2(t) less than gnull(F1(t)) for some t.

gnull

variable margin function under null hypothesis (more formally, at the boundary between the null and alternative hypotheses for the pre-specified hypotheses)

galt

variable margin function for which we calculate the power

minn

minimum value for sample size for n1, input into uniroot.integer.

maxn

maximum value for sample size for n1, input into uniroot.integer.

...

extra arguments passed to uniroot.integer.

Details

The function either calculates the power (if n1=NULL) or calculates n1 and n2 (if power=NULL). In the latter case, we use uniroot.integer to find the smallest n1 that gives power at least as large as the given power [with n2 defined as ceiling(n2.over.n1*n1)].

Value

a power.htest object. A list with elements:

n1

sample size for control group

n2

sample size for test group

delta0

F2(tau)-F1(tau), with tau defined by F1(tau)=q

q

probability associated with tau

sig.level

significance level

power

power under galt

method

character description of method

See Also

nicqTest

Examples

1
2
3
4
5
6
7
8
9
# to calculate power, leave power=NULL and supply n1 and n2
powerNicqTest(n1=200,n2=300)
# or supply n1 and n2.over.n1
powerNicqTest(n1=200,n2.over.n1=3/2)
## to calculate n1 and n2, supply power
## find minimum n1 that have power greater than 0.80
## takes 13 iterations to find n1=346
## so do not run it here
#powerNicqTest(power=.80,print.steps=TRUE)

nivm documentation built on May 2, 2019, 8:22 a.m.