nNormal: Normal distribution sample size (2-sample)

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

Description

nNormal() computes a fixed design sample size for comparing 2 means where variance is known. T The function allows computation of sample size for a non-inferiority hypothesis. Note that you may wish to investigate other R packages such as the pwr package which uses the t-distr

Usage

1
2
nNormal(delta1=1,sd=1.7,sd2=NULL,alpha=.025,beta=.1,ratio=1, sided=1,
n=NULL,delta0=0,outtype=1)

Arguments

delta1

difference between sample means under the alternate hypothesis.

delta0

difference between sample means under the null hypothesis; normally this will be left as the default of 0.

ratio

randomization ratio of experimental group compared to control.

sided

1 for 1-sided test (default), 2 for 2-sided test.

sd

Standard deviation for the control arm.

sd2

Standard deviation of experimental arm; this will be set to be the same as the control arm with the default of NULL.

alpha

type I error rate. Default is 0.025 since 1-sided testing is default.

beta

type II error rate. Default is 0.10 (90% power). Not needed if n is provided.

n

Sample size; may be input to compute power rather than sample size. If NULL (default) then sample size is computed.

delta0default value of 0 is set to test for superiority; negative values used for non-inferiority (assuming delta1>0).

outtype

controls output; see value section below.

Details

nNormal() computes sample size for comparing two normal means when the variance for observations in

Value

If n is NULL (default), total sample size (2 arms combined) is computed. Otherwise, power is computed. If outtype=1 (default), the computed value (sample size or power) is returned in a scalar or vector. If outtype=2, a data frame with sample sizes for each arm (n1, n2)is returned; if n is not input as NULL, a third variable, Power, is added to the output data frame. If outtype=3, a data frame with is returned with the following columns:

n

A vector with total samples size required for each event rate comparison specified

n1

A vector of sample sizes for group 1 for each event rate comparison specified

n2

A vector of sample sizes for group 2 for each event rate comparison specified

alpha

As input

sided

As input

beta

As input; if n is input, this is computed

Power

If n=NULL on input, this is 1-beta; otherwise, the power is computed for each sample size input

sd

As input

sd2

As input

delta1

As input

delta0

As input

se

standard error for estimate of difference in treatment group means

Author(s)

Keaven Anderson keaven_anderson@merck.com

References

Lachin JM (1981), Introduction to sample size determination and power analysis for clinical trials. Controlled Clinical Trials 2:93-113.

Snedecor GW and Cochran WG (1989), Statistical Methods. 8th ed. Ames, IA: Iowa State University Press.

See Also

gsDesign package overview

Examples

1
2
3
4
5
6
7
8
9
# EXAMPLES
# equal variances
nNormal(delta1=.5,sd=1.1,alpha=.025,beta=.2)
# unequal variances
nNormal(delta1=.5,sd=1.1,sd2=2,alpha=.025,beta=.2)
# unequal sample sizes
nNormal(delta1=.5,sd=1.1,alpha=.025,beta=.2, ratio=2)
# non-inferiority assuming a better effect than null
nNormal(delta1=.5,delta0=-.1,sd=1.2)

gsDesign documentation built on May 2, 2019, 4:49 p.m.