n.symm.test {TestsSymmetry} | R Documentation |
Sample size determination for nonparametric tests of symmetry when the center is unknown
Description
Determine the sample size required for one-sample Wilcoxon signed-rank test or Sign test with an unknown symmetry center estimated by sample mean given a target power.The function uses learning sample in order to predict (calculate) sample size needed to reach a preassumed power based on the underlying data that is exemplified by the learning sample.
Usage
n.symm.test(
x,
sig.level = 0.05,
power = 0.8,
method = "wilcox",
alternative = c("two.sided")
)
Arguments
x |
learning sample data, numeric vector of data values |
sig.level |
significance level (Type I error probability), the default value is 0.05 |
power |
power of test (1 minus Type II error probability), the default value is 0.8 |
method |
a character string specifying which symmetry test to be used, "wilcox" refers to Wilcoxon signed-rank test, and "sign" sign test |
alternative |
a character string specifying the alternative hypothesis "two.sided" : test whether skewed |
Details
A Normal approximation to the power requires specification of some unknown quantities in the nonparametric context. In this regard, empirical smoothed CDF and Bootstrap methods were leveraged to estimate these quantities using learning sample 'x'.
Remark: If the test provides a power, say, P, based on the learning data and P is higher than the target power, a warning message will be shown. However, a needed sample size N to reach the target power will be conducted.
Value
A list of class "power.htest" containing the following components:
N - sample size estimated
sig.level - significance level (Type I error probability)
power - power of test (1 minus Type II error probability)
method - the test method applied
alternative - two-sided test. Can be abbreviated
References
Chakraborti, S., Hong, B., & van de Wiel, M. A. (2006). A Note on Sample Size Determination for a Nonparametric Test of Location. Technometrics, 48(1), 88-94.
Vexler, A., Gao, X., & Zhou, J. (2023). How to implement signed-rank 'wilcox.test()' type procedures when a center of symmetry is unknown. Computational Statistics & Data Analysis, 107746.
Gastwirth, J. L. (1971). On the Sign Test for Symmetry. Journal of the American Statistical Association, 66(336), 821-823.
Examples
data("plasma.silicon")
post <- plasma.silicon$postoperative
pre <- plasma.silicon$preoperative
diff <- post - pre
n.symm.test(diff, sig.level = 0.05, power = 0.5, method = "wilcox", alternative ="two.sided" )
# Result:
# Sample size calculation under wilcox procedure
# N = 83
# sig.level = 0.05
# power = 0.5
# type = wilcox
# alternative = two.sided
# Interpretation:
# Given the pilot sample `diff` and the significance level 0.05. The sample size of
# the data that is expected toprovide the target power 0.5 of the Wilcoxon test procedure
# is computed as 83.