Type: | Package |
Title: | Sample Size Calculation for Various t-Tests and Wilcoxon-Test |
Version: | 0.2-4 |
Date: | 2016-12-22 |
Author: | Ralph Scherer |
Maintainer: | Ralph Scherer <shearer.ra76@gmail.com> |
Description: | Computes sample size for Student's t-test and for the Wilcoxon-Mann-Whitney test for categorical data. The t-test function allows paired and unpaired (balanced / unbalanced) designs as well as homogeneous and heterogeneous variances. The Wilcoxon function allows for ties. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://github.com/shearer/samplesize |
BugReports: | https://github.com/shearer/samplesize/issues |
NeedsCompilation: | no |
Packaged: | 2016-12-23 21:02:40 UTC; ralph |
Repository: | CRAN |
Date/Publication: | 2016-12-24 11:24:04 |
Computes sample size for several two-sample tests
Description
Computes sample size for independent and paired Student's t-test, Student's t-test with Welch-approximation, Wilcoxon-Mann-Whitney test with and without ties on ordinal data
Details
Package: | samplesize |
Type: | Package |
Version: | 0.2-4 |
Date: | 2016-12-22 |
License: | GPL (>=2) |
LazyLoad: | yes |
n.ttest(): sample size for Student's t-test and t-test with Welch approximation
n.wilcox.ord(): sample size for Wilcoxon-Mann-Whitney test with and without ties
Author(s)
Ralph Scherer
Maintainer: Ralph Scherer <shearer.ra@gmail.com>
References
Bock J., Bestimmung des Stichprobenumfangs fuer biologische Experimente und kontrollierte klinische Studien. Oldenbourg 1998
Zhao YD, Rahardja D, Qu Yongming. Sample size calculation for the Wilcoxon-Mann-Whitney test adjusting for ties. Statistics in Medicine 2008; 27:462-468
n.ttest computes sample size for paired and unpaired t-tests.
Description
n.ttest computes sample size for paired and unpaired t-tests. Design may be balanced or unbalanced. Homogeneous and heterogeneous variances are allowed.
Usage
n.ttest(power = 0.8, alpha = 0.05, mean.diff = 0.8, sd1 = 0.83, sd2 = sd1,
k = 1, design = "unpaired", fraction = "balanced", variance = "equal")
Arguments
power |
Power (1 - Type-II-error) |
alpha |
Two-sided Type-I-error |
mean.diff |
Expected mean difference |
sd1 |
Standard deviation in group 1 |
sd2 |
Standard deviation in group 2 |
k |
Sample fraction k |
design |
Type of design. May be paired or unpaired |
fraction |
Type of fraction. May be balanced or unbalanced |
variance |
Type of variance. May be homo- or heterogeneous |
Value
Total sample size |
Sample size for both groups together |
Sample size group 1 |
Sample size in group 1 |
Sample size group 2 |
Sample size in group 2 |
Author(s)
Ralph Scherer
References
Bock J., Bestimmung des Stichprobenumfangs fuer biologische Experimente und kontrollierte klinische Studien. Oldenbourg 1998
Examples
n.ttest(power = 0.8, alpha = 0.05, mean.diff = 0.80, sd1 = 0.83, k = 1,
design = "unpaired", fraction = "balanced", variance = "equal")
n.ttest(power = 0.8, alpha = 0.05, mean.diff = 0.80, sd1 = 0.83, sd2 =
2.65, k = 0.7, design = "unpaired", fraction = "unbalanced", variance =
"unequal")
Sample size for Wilcoxon-Mann-Whitney for ordinal data
Description
Function computes sample size for the two-sided Wilcoxon test when applied to two independent samples with ordered categorical responses.
Usage
n.wilcox.ord(power = 0.8, alpha = 0.05, t, p, q)
Arguments
power |
required Power |
alpha |
required two-sided Type-I-error level |
t |
sample size fraction n/N, where n is sample size of group B and N is the total sample size |
p |
vector of expected proportions of the categories in group A, should sum to 1 |
q |
vector of expected proportions of the categories in group B, should be of equal length as p and should sum to 1 |
Details
This function approximates the total sample size, N, needed for the two-sided Wilcoxon test when comparing two independent samples, A and B, when data are ordered categorical according to Equation 12 in Zhao et al.(2008). Assuming that the response consists of D ordered categories C_1 ,..., C_D
. The expected proportions of these categories in two treatments A and B must be specified as numeric vectors p_1,...,p_D
and q_1,...,q_D
, respectively. The argument t allows to compute power for an unbalanced design, where t=n_B/N
is the proportion of sample size in treatment B.
Value
total sample size |
Total sample size |
m |
Sample size group 1 |
n |
Sample size group 2 |
Author(s)
Ralph Scherer
References
Zhao YD, Rahardja D, Qu Yongming. Sample size calculation for the Wilcoxon-Mann-Whitney test adjsuting for ties. Statistics in Medicine 2008; 27:462-468
Examples
## example out of:
## Zhao YD, Rahardja D, Qu Yongming.
## Sample size calculation for the Wilcoxon-Mann-Whitney test adjsuting for ties.
## Statistics in Medicine 2008; 27:462-468
n.wilcox.ord(power = 0.8, alpha = 0.05, t = 0.53, p = c(0.66, 0.15, 0.19), q = c(0.61, 0.23, 0.16))