Description Usage Arguments Details Value Author(s) References See Also Examples
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
1 2 |
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 |
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 |
Sample size; may be input to compute power rather than sample size. If |
delta0
default 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. |
nNormal()
computes sample size for comparing two normal means when the variance for observations in
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 |
Power |
If |
sd |
As input |
sd2 |
As input |
delta1 |
As input |
delta0 |
As input |
se |
standard error for estimate of difference in treatment group means |
Keaven Anderson keaven_anderson@merck.com
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.
gsDesign package overview
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.