Title: | Sequential Triangular Test |
---|---|
Description: | Sequential triangular test for the arithmetic mean in one- and two- samples, proportions in one- and two-samples, and the Pearson's correlation coefficient. |
Authors: | Takuya Yanagida [cre, aut] |
Maintainer: | Takuya Yanagida <[email protected]> |
License: | GPL-3 |
Version: | 0.1-0 |
Built: | 2024-12-07 06:39:35 UTC |
Source: | CRAN |
This function prints descriptive statistics for the seqtest
object
descript(x, digits = 2, output = TRUE)
descript(x, digits = 2, output = TRUE)
x |
|
digits |
integer indicating the number of decimal places to be displayed. |
output |
logical: if |
Takuya Yanagida [email protected]
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
seqtest.mean
, seqtest.prop
, seqtest.cor
, plot.seqtest
, descript
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2) seq.obj <- update(seq.obj, x = c(54, 52, 46, 49)) descript(seq.obj) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) descript(seq.obj) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.56, 0.52)) descript(seq.obj)
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2) seq.obj <- update(seq.obj, x = c(54, 52, 46, 49)) descript(seq.obj) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) descript(seq.obj) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.56, 0.52)) descript(seq.obj)
This function plots the seqtest
object
## S3 method for class 'seqtest' plot(x, ...)
## S3 method for class 'seqtest' plot(x, ...)
x |
|
... |
further arguments passed to or from other methods |
Takuya Yanagida [email protected]
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
seqtest.mean
, seqtest.prop
, seqtest.cor
, print.seqtest
, descript
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2) plot(seq.obj) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2) plot(seq.obj) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2) plot(seq.obj)
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2) plot(seq.obj) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2) plot(seq.obj) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2) plot(seq.obj)
This function plots the sim.seqtest.cor
object
## S3 method for class 'sim.seqtest.cor' plot(x, plot.lines = TRUE, plot.nom = TRUE, ylim = NULL, type = "b", pch = 19, lty = 1, lwd = 1, ...)
## S3 method for class 'sim.seqtest.cor' plot(x, plot.lines = TRUE, plot.nom = TRUE, ylim = NULL, type = "b", pch = 19, lty = 1, lwd = 1, ...)
x |
|
plot.lines |
plot lines connecting points withe the x- and y-axis. |
plot.nom |
plot line at the nominal alpha. |
ylim |
the y limits of the plot. |
type |
what type of plot should be drawn ( |
pch |
plotting character. |
lty |
line type. |
lwd |
line width. |
... |
further arguments passed to or from other methods. |
Takuya Yanagida [email protected]
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
## Not run: #--------------------------------------------- # Determine optimal k and nominal type-II-risk # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.01, beta = 0.05, delta = 0.25 # Step 1: Determine the optimal size of subsamples (k) sim.obj.1 <- sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = 0.05, runs = 10000) plot(sim.obj.1) # Step 2: Determine the optimal nominal type-II-risk based on # the optimal size of subsamples (k) from step 1 sim.obj.2 <- sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01), runs = 10000) plot(sim.obj.2) ## End(Not run)
## Not run: #--------------------------------------------- # Determine optimal k and nominal type-II-risk # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.01, beta = 0.05, delta = 0.25 # Step 1: Determine the optimal size of subsamples (k) sim.obj.1 <- sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = 0.05, runs = 10000) plot(sim.obj.1) # Step 2: Determine the optimal nominal type-II-risk based on # the optimal size of subsamples (k) from step 1 sim.obj.2 <- sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01), runs = 10000) plot(sim.obj.2) ## End(Not run)
This function prints the seqtest
object
## S3 method for class 'seqtest' print(x, ...)
## S3 method for class 'seqtest' print(x, ...)
x |
|
... |
further arguments passed to or from other methods. |
Takuya Yanagida [email protected]
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
seqtest.mean
, seqtest.prop
, seqtest.cor
, plot.seqtest
, descript
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2, output = FALSE) print(seq.obj) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2, output = FALSE) print(seq.obj) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, output = FALSE) print(seq.obj)
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2, output = FALSE) print(seq.obj) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2, output = FALSE) print(seq.obj) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, output = FALSE) print(seq.obj)
This function prints the sim.seqtest.cor
object
## S3 method for class 'sim.seqtest.cor' print(x, ...)
## S3 method for class 'sim.seqtest.cor' print(x, ...)
x |
|
... |
further arguments passed to or from other methods. |
Takuya Yanagida [email protected]
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
sim.seqtest.cor
, plot.sim.seqtest.cor
## Not run: #--------------------------------------------- # Determine optimal k and nominal type-II-risk # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.01, beta = 0.05, delta = 0.25 # Step 1: Determine the optimal size of subsamples (k) sim.obj <- sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = 0.05, runs = 10000, output = FALSE) print(sim.obj) # Step 2: Determine the optimal nominal type-II-risk based on # the optimal size of subsamples (k) from step 1 sim.obj <- sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01), runs = 10000, output = FALSE) print(sim.obj) ## End(Not run)
## Not run: #--------------------------------------------- # Determine optimal k and nominal type-II-risk # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.01, beta = 0.05, delta = 0.25 # Step 1: Determine the optimal size of subsamples (k) sim.obj <- sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = 0.05, runs = 10000, output = FALSE) print(sim.obj) # Step 2: Determine the optimal nominal type-II-risk based on # the optimal size of subsamples (k) from step 1 sim.obj <- sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01), runs = 10000, output = FALSE) print(sim.obj) ## End(Not run)
This function prints the size
object
## S3 method for class 'size' print(x, ...)
## S3 method for class 'size' print(x, ...)
x |
|
... |
further arguments passed to or from other methods. |
Takuya Yanagida [email protected]
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
size.mean
, size.prop
, size.cor
#-------------------------------------- # Two-sided one-sample test # theta = 0.5 # alpha = 0.05, beta = 0.2 n <- size.mean(theta = 0.5, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) print(n) #-------------------------------------- # Two-sided one-sample test # H0: pi = 0.5, H1: pi != 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 n <- size.prop(delta = 0.2, pi = 0.5, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) print(n) #-------------------------------------- # H0: rho = 0.3, H1: rho != 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 n <- size.cor(delta = 0.2, rho = 0.3, alpha = 0.05, beta = 0.2) print(n)
#-------------------------------------- # Two-sided one-sample test # theta = 0.5 # alpha = 0.05, beta = 0.2 n <- size.mean(theta = 0.5, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) print(n) #-------------------------------------- # Two-sided one-sample test # H0: pi = 0.5, H1: pi != 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 n <- size.prop(delta = 0.2, pi = 0.5, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) print(n) #-------------------------------------- # H0: rho = 0.3, H1: rho != 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 n <- size.cor(delta = 0.2, rho = 0.3, alpha = 0.05, beta = 0.2) print(n)
This function performs the sequential triangular test for Pearson's correlation coefficient
seqtest.cor(x, k, rho, alternative = c("two.sided", "less", "greater"), delta, alpha = 0.05, beta = 0.1, output = TRUE, plot = FALSE)
seqtest.cor(x, k, rho, alternative = c("two.sided", "less", "greater"), delta, alpha = 0.05, beta = 0.1, output = TRUE, plot = FALSE)
x |
initial data, i.e., Pearson's correlation coefficient in a sub-sample of k observations. |
k |
number of observations in each sub-sample. |
rho |
a number indicating the correlation coefficient under the null hypothesis, |
alternative |
a character string specifying the alternative hypothesis, |
delta |
minimum difference to be detected, |
alpha |
type-I-risk, |
beta |
type-II-risk, |
output |
logical: if |
plot |
logical: if |
Null and alternative hypothesis is specified using arguments rho
and delta
.
Note that the argument k (i.e., number of observations in each sub-sample) has to be specified. At least k = 4 is needed.
The optimal value of k should be determined based on statistical simulation using sim.seqtest.cor
function.
In order to specify a one-sided test, argument alternative
has to be used (i.e., two-sided tests are conducted by default).
That is, alternative = "less"
specifies the null hypothesis, H0: >=
.0 and
the alternative hypothesis, H1:
<
.0;
alternative = "greater"
specifies the
null hypothesis, H0: <=
.0 and the alternative hypothesis, H1:
>
.0.
The main characteristic of the sequential triangular test is that there is no fixed sample size given
in advance. That is, for the most recent sampling point, one has to decide whether
sampling has to be continued or either the null- or the alternative hypothesis can be
accepted given specified precision requirements (i.e. type-I-risk, type-II-risk and an effect size).
The sequence of data pairs must we split into sub-samples of length k >= 4 each.
The (cumulative) test statistic Z.m
on a Cartesian coordinate system produces a "sequential path" on a
continuation area as a triangle. As long as the statistic remains within that triangle,
additional data have to be sampled. If the path touches or exceeds the borderlines of the triangle,
sampling is completed. Depending on the particular borderline, the null-hypothesis is either
accepted or rejected.
Returns an object of class seqtest
, to be used for later update steps. The object has
following entries:
call |
function call |
type |
type of the test (i.e., correlation coefficient) |
spec |
specification of function arguments |
tri |
specification of triangular |
dat |
data |
res |
list with results |
Takuya Yanagida [email protected],
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
update.seqtest
, sim.seqtest.cor
, seqtest.mean
, seqtest.prop
,
print.seqtest
, plot.seqtest
, descript
#-------------------------------------- # H0: rho = 0.3, H1: rho != 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.56, 0.52)) #-------------------------------------- # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, alternative = "greater", delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.66))
#-------------------------------------- # H0: rho = 0.3, H1: rho != 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.56, 0.52)) #-------------------------------------- # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, alternative = "greater", delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.66))
This function performs the sequential triangular test for the arithmetic mean in one- or two-samples
seqtest.mean(x, y = NULL, mu = NULL, alternative = c("two.sided", "less", "greater"), sigma = NULL, delta = NULL, theta = NULL, alpha = 0.05, beta = 0.1, output = TRUE, plot = FALSE)
seqtest.mean(x, y = NULL, mu = NULL, alternative = c("two.sided", "less", "greater"), sigma = NULL, delta = NULL, theta = NULL, alpha = 0.05, beta = 0.1, output = TRUE, plot = FALSE)
x |
initial data for group x, at least one entry. |
y |
initial data for group y, at least one entry for a two-sample test. |
mu |
a number indicating the true value of the mean in case of the one-sample test, |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
sigma |
standard deviation in the population, |
delta |
absolute minimum difference to be detected, |
theta |
relative minimum difference to be detected, |
alpha |
type-I-risk, |
beta |
type-II-risk, |
output |
logical: if |
plot |
logical: if |
For the one-sample test, arguments x
, mu
and the minimum difference to be detected
has to be specified (i.e., argument y
must not be specified). For the two-sample test, arguments
x
, y
, and the minimum difference to be detected has to be specified. There are two options to specify
the minimum difference to be detected: (1) using arguments mu
, sigma
and delta
or
(2) using arguments mu
and theta
.
Note that it is not a requirement to know sigma in advance, i.e., theta can be specified directly. For example,
theta = 1
specifies a relative minimum difference to be detected of one standard deviation.
In order to specify a one-sided test, argument alternative
has to be used (i.e., two-sided tests are conducted by default).
For the one-sample test, alternative = "less"
specifies the null hypothesis, H0: >=
.0
and the alternative hypothesis, H1:
<
.0;
alternative = "greater"
specifies the
null hypothesis, H0: <=
.0 and the alternative hypothesis, H1:
>
.0.
For the two-sample test
alternative = "less"
specifies the null hypothesis, H0: .1 >=
.2
and the alternative hypothesis, H1:
.1 <
.2;
alternative = "greater"
specifies
the null hypothesis, H0: .1 <=
.2 and the alternative hypothesis, H1:
.1 >
.2.
The main characteristic of the sequential triangular test is that there is no fixed sample size given
in advance. That is, for the most recent sampling point, one has to decide whether
sampling has to be continued or either the null- or the alternative hypothesis can be
accepted given specified precision requirements (i.e. type-I-risk, type-II-risk and a minimum difference to be detected).
The (cumulative) test statistic Z.m
on a Cartesian coordinate system produces a "sequential path"
on a continuation area as a triangle. As long as the statistic remains within that triangle,
additional data have to be sampled. If the path touches or exceeds the borderlines of the triangle,
sampling is completed. Depending on the particular borderline, the null-hypothesis is either
accepted or rejected.
Returns an object of class seqtest
, to be used for later update steps. The object has
following entries:
call |
function call |
type |
type of the test (i.e., arithmetic mean) |
spec |
specification of function arguments |
tri |
specification of the triangular |
dat |
data |
res |
list with results |
Takuya Yanagida [email protected],
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
update.seqtest
, seqtest.prop
, seqtest.cor
,
print.seqtest
, plot.seqtest
, descript
#-------------------------------------- # Two-sided one-sample test # H0: mu = 50, H1: mu != 50 # alpha = 0.05, beta = 0.2, theta = 0.5 seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(56, mu = 50, sigma = 10, delta = 5, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(54, 52, 46, 49)) seq.obj <- update(seq.obj, x = c(46, 49, 51, 45)) seq.obj <- update(seq.obj, x = c(51, 42, 50, 53)) seq.obj <- update(seq.obj, x = c(50, 53, 49, 53)) #-------------------------------------- # One-sided one-sample test # H0: mu <= 50, H1: mu > 50 # alpha = 0.05, beta = 0.2, theta = 0.5 seq.obj <- seqtest.mean(c(56, 53), mu = 50, alternative = "greater", theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(c(56, 53), mu = 50, alternative = "greater", sigma = 10, delta = 5, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(67, 52, 48, 59)) seq.obj <- update(seq.obj, x = c(53, 57, 54, 62)) seq.obj <- update(seq.obj, x = 58) #-------------------------------------- # Two-sided two-sample test # H0: mu.1 = mu.2, H1: mu.1 != mu.2 # alpha = 0.01, beta = 0.1, theta = 1 seq.obj <- seqtest.mean(53, 45, theta = 1, alpha = 0.01, beta = 0.01, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(57, 45, sigma = 10, delta = 10, alpha = 0.01, beta = 0.01, plot = TRUE) seq.obj <- update(seq.obj, x = c(58, 54, 56), y = c(45, 41, 42)) seq.obj <- update(seq.obj, x = c(56, 50, 49), y = c(42, 45, 50)) seq.obj <- update(seq.obj, x = c(62, 57, 59)) seq.obj <- update(seq.obj, y = c(41, 39, 46)) seq.obj <- update(seq.obj, x = 67) seq.obj <- update(seq.obj, y = 40) seq.obj <- update(seq.obj, y = 36) #-------------------------------------- # One-sided two-sample test # H0: mu.1 <= mu.2, H1: mu.1 > mu.2 # alpha = 0.01, beta = 0.1, theta = 1 seq.obj <- seqtest.mean(53, 45, alternative = "greater", theta = 1, alpha = 0.01, beta = 0.01, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(57, 45, alternative = "greater",sigma = 10, delta = 10, alpha = 0.01, beta = 0.01, plot = TRUE) seq.obj <- update(seq.obj, x = c(58, 54, 56), y = c(45, 41, 42)) seq.obj <- update(seq.obj, x = c(56, 50, 49), y = c(42, 45, 50)) seq.obj <- update(seq.obj, x = c(62, 57, 59)) seq.obj <- update(seq.obj, y = c(41, 39, 46))
#-------------------------------------- # Two-sided one-sample test # H0: mu = 50, H1: mu != 50 # alpha = 0.05, beta = 0.2, theta = 0.5 seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(56, mu = 50, sigma = 10, delta = 5, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(54, 52, 46, 49)) seq.obj <- update(seq.obj, x = c(46, 49, 51, 45)) seq.obj <- update(seq.obj, x = c(51, 42, 50, 53)) seq.obj <- update(seq.obj, x = c(50, 53, 49, 53)) #-------------------------------------- # One-sided one-sample test # H0: mu <= 50, H1: mu > 50 # alpha = 0.05, beta = 0.2, theta = 0.5 seq.obj <- seqtest.mean(c(56, 53), mu = 50, alternative = "greater", theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(c(56, 53), mu = 50, alternative = "greater", sigma = 10, delta = 5, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(67, 52, 48, 59)) seq.obj <- update(seq.obj, x = c(53, 57, 54, 62)) seq.obj <- update(seq.obj, x = 58) #-------------------------------------- # Two-sided two-sample test # H0: mu.1 = mu.2, H1: mu.1 != mu.2 # alpha = 0.01, beta = 0.1, theta = 1 seq.obj <- seqtest.mean(53, 45, theta = 1, alpha = 0.01, beta = 0.01, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(57, 45, sigma = 10, delta = 10, alpha = 0.01, beta = 0.01, plot = TRUE) seq.obj <- update(seq.obj, x = c(58, 54, 56), y = c(45, 41, 42)) seq.obj <- update(seq.obj, x = c(56, 50, 49), y = c(42, 45, 50)) seq.obj <- update(seq.obj, x = c(62, 57, 59)) seq.obj <- update(seq.obj, y = c(41, 39, 46)) seq.obj <- update(seq.obj, x = 67) seq.obj <- update(seq.obj, y = 40) seq.obj <- update(seq.obj, y = 36) #-------------------------------------- # One-sided two-sample test # H0: mu.1 <= mu.2, H1: mu.1 > mu.2 # alpha = 0.01, beta = 0.1, theta = 1 seq.obj <- seqtest.mean(53, 45, alternative = "greater", theta = 1, alpha = 0.01, beta = 0.01, plot = TRUE) # alternative specifiation using sigma and delta seq.obj <- seqtest.mean(57, 45, alternative = "greater",sigma = 10, delta = 10, alpha = 0.01, beta = 0.01, plot = TRUE) seq.obj <- update(seq.obj, x = c(58, 54, 56), y = c(45, 41, 42)) seq.obj <- update(seq.obj, x = c(56, 50, 49), y = c(42, 45, 50)) seq.obj <- update(seq.obj, x = c(62, 57, 59)) seq.obj <- update(seq.obj, y = c(41, 39, 46))
This function performs the sequential triangular test for the proportion in one- or two-samples
seqtest.prop(x, y = NULL, pi = NULL, alternative = c("two.sided", "less", "greater"), delta, alpha = 0.05, beta = 0.1, output = TRUE, plot = FALSE)
seqtest.prop(x, y = NULL, pi = NULL, alternative = c("two.sided", "less", "greater"), delta, alpha = 0.05, beta = 0.1, output = TRUE, plot = FALSE)
x |
initial data for group x, at least one entry. |
y |
initial data for group y, at least one entry for a two-sample test. |
pi |
a number indicating the true value of the probability of success in group x, |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "less" or "greater". |
delta |
minimum difference to be detected, |
alpha |
type-I-risk, |
beta |
type-II-risk, |
output |
logical: if |
plot |
logical: if |
For the one-sample test, arguments x
, pi
, and delta
has to be specified
(i.e., argument y
must not be specified).
For the two-sample test, arguments x
, y
, pi
, and delta
has to be specified
In order to specify a one-sided test, argument alternative
has to be used (i.e., two-sided tests are conducted by default).
For the one-sample test, alternative = "less"
specifies the null hypothesis, H0: >=
.0
and the alternative hypothesis, H1:
<
.0;
alternative = "greater"
specifies the
null hypothesis, H0: <=
.0 and the alternative hypothesis, H1:
>
.0.
For the two-sample test
alternative = "less"
specifies the null hypothesis, H0: .1 >=
.2
and the alternative hypothesis, H1:
.1 <
.2;
alternative = "greater"
specifies
the null hypothesis, H0: .1 <=
.2 and the alternative hypothesis, H1:
.1 >
.2.
The main characteristic of the sequential triangular test is that there is no fixed sample size given
in advance. That is, for the most recent sampling point, one has to decide whether
sampling has to be continued or either the null- or the alternative hypothesis can be
accepted given specified precision requirements (i.e. type-I-risk, type-II-risk and an effect size).
The (cumulative) test statistic Z.m
on a Cartesian coordinate system produces a "sequential path"
on a continuation area as a triangle. As long as the statistic remains within that triangle,
additional data have to be sampled. If the path touches or exceeds the borderlines of the triangle,
sampling is completed. Depending on the particular borderline, the null-hypothesis is either
accepted or rejected.
Returns an object of class seqtest
, to be used for later update steps. The object has
following entries:
call |
function call |
type |
type of the test (i.e., proportion) |
spec |
specification of function arguments |
tri |
specification of the triangular |
dat |
data |
res |
list with results |
Takuya Yanagida [email protected],
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
update.seqtest
, seqtest.mean
, seqtest.cor
,
print.seqtest
, plot.seqtest
, descript
#-------------------------------------- # Two-sided one-sample test # H0: pi = 0.5, H1: pi != 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1)) seq.obj <- update(seq.obj, x = c(1, 1)) #-------------------------------------- # One-sided one-sample test # H0: pi <= 0.5, H1: pi > 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, alternative = "greater", delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1)) #-------------------------------------- # Two-sided two-sample test # H0: pi.1 = pi.2 = 0.5, H1: pi.1 != pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 seq.obj <- seqtest.prop(1, 0, pi = 0.5, delta = 0.2, alpha = 0.01, beta = 0.1, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 0), y = c(0, 0, 1, 0)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1), y = c(0, 0, 0, 0)) seq.obj <- update(seq.obj, x = c(1, 0, 1, 1), y = c(0, 0, 0, 1)) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1), y = c(0, 0, 0, 0)) seq.obj <- update(seq.obj, x = c(0, 1, 0, 1)) seq.obj <- update(seq.obj, y = c(0, 0, 0, 1)) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1)) #-------------------------------------- # One-sided two-sample test # H0: pi.1 <= pi.1 = 0.5, H1: pi.1 > pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 seq.obj <- seqtest.prop(1, 0, pi = 0.5, delta = 0.2, alternative = "greater", alpha = 0.01, beta = 0.1, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 0), y = c(0, 0, 1, 0)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1), y = c(0, 0, 0, 0)) seq.obj <- update(seq.obj, x = c(1, 0, 1, 1), y = c(0, 0, 0, 1)) seq.obj <- update(seq.obj, x = c(1, 1, 1), y = c(0, 0))
#-------------------------------------- # Two-sided one-sample test # H0: pi = 0.5, H1: pi != 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1)) seq.obj <- update(seq.obj, x = c(1, 1)) #-------------------------------------- # One-sided one-sample test # H0: pi <= 0.5, H1: pi > 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, alternative = "greater", delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1)) #-------------------------------------- # Two-sided two-sample test # H0: pi.1 = pi.2 = 0.5, H1: pi.1 != pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 seq.obj <- seqtest.prop(1, 0, pi = 0.5, delta = 0.2, alpha = 0.01, beta = 0.1, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 0), y = c(0, 0, 1, 0)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1), y = c(0, 0, 0, 0)) seq.obj <- update(seq.obj, x = c(1, 0, 1, 1), y = c(0, 0, 0, 1)) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1), y = c(0, 0, 0, 0)) seq.obj <- update(seq.obj, x = c(0, 1, 0, 1)) seq.obj <- update(seq.obj, y = c(0, 0, 0, 1)) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1)) #-------------------------------------- # One-sided two-sample test # H0: pi.1 <= pi.1 = 0.5, H1: pi.1 > pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 seq.obj <- seqtest.prop(1, 0, pi = 0.5, delta = 0.2, alternative = "greater", alpha = 0.01, beta = 0.1, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 0), y = c(0, 0, 1, 0)) seq.obj <- update(seq.obj, x = c(0, 1, 1, 1), y = c(0, 0, 0, 0)) seq.obj <- update(seq.obj, x = c(1, 0, 1, 1), y = c(0, 0, 0, 1)) seq.obj <- update(seq.obj, x = c(1, 1, 1), y = c(0, 0))
This function performs a statistical simulation for the sequential triangular test for Pearson's correlation coefficient.
sim.seqtest.cor(rho.sim, k, rho, alternative = c("two.sided", "less", "greater"), delta, alpha = 0.05, beta = 0.1, runs = 1000, m.x = 0, sd.x = 1, m.y = 0, sd.y = 1, digits = 3, output = TRUE, plot = FALSE)
sim.seqtest.cor(rho.sim, k, rho, alternative = c("two.sided", "less", "greater"), delta, alpha = 0.05, beta = 0.1, runs = 1000, m.x = 0, sd.x = 1, m.y = 0, sd.y = 1, digits = 3, output = TRUE, plot = FALSE)
rho.sim |
simulated population correlation coefficient, |
k |
an integer or a numerical vector indicating the number of observations in each sub-sample. |
rho |
a number indicating the correlation coefficient under the null hypothesis, |
alternative |
a character string specifying the alternative hypothesis, |
delta |
minimum difference to be detected, |
alpha |
type-I-risk, |
beta |
an integer or a numerical vector indicating the type-II-risk, |
runs |
numer of simulation runs. |
m.x |
population mean of simulated vector x. |
sd.x |
population standard deviation of simulated vector x. |
m.y |
population mean of simulated vector y. |
sd.y |
population standard deviation of simulated vector y. |
digits |
integer indicating the number of decimal places to be displayed. |
output |
logical: if |
plot |
logical: if |
In order to determine the optimal k, simulation is conducted under the H0 condition, i.e., rho.sim
= rho
.
Simulation is carried out for a sequence of k values to seek for the optimal k where the empirical alpha is as close
as possible to the nominal alpha.
In order to determine optimal beta (with fixed k), simulation is conudcted under the H1 condition,
i.e., rho.sim
= rho
+ delta
or rho.sim
= rho
- delta
.
Simulation is carried out for a sequencen of beta values to seek for the optimal beta where the empirical beta
is as close as possible to the nominal beta.
In order to specify a one-sided test, argument alternative
has to be used (i.e., two-sided tests are conducted by default).
Specifying argument alternative = "less"
conducts the simulation for the null hypothesis, H0: >=
.0
with the alternative hypothesis, H1:
<
.0; specifying argument
alternative = "greater"
conducts the simluation
for the null hypothesis, H0: <=
.0 with the alternative hypothesis, H1:
>
.0.
Returns an object of class sim.seqtest.cor
with following entries:
call |
function call |
spec |
specification of function arguments |
simres |
list with results (for each k or beta) for each run |
res |
data.frame with results, i.e., k, alpha.nom (nominal alpha), alpha.emp (estimated empirical alpha), beta.nom (nominal beta), beta.emp (empirica beta), p.H0 (proportion decision = H0), p.H1 (proportion decision = H1), AVN (average number of V), ASN (average number of sample pairs) |
Takuya Yanagida [email protected],
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
seqtest.cor
, plot.sim.seqtest.cor
, print.sim.seqtest.cor
## Not run: #--------------------------------------------- # Determine optimal k and nominal type-II-risk # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.01, beta = 0.05, delta = 0.25 # Step 1: Determine the optimal size of subsamples (k) sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = 0.05, runs = 10000, plot = TRUE) # Step 2: Determine the optimal nominal type-II-risk based on # the optimal size of subsamples (k) from step 1 sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01), runs = 10000, plot = TRUE) ## End(Not run)
## Not run: #--------------------------------------------- # Determine optimal k and nominal type-II-risk # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.01, beta = 0.05, delta = 0.25 # Step 1: Determine the optimal size of subsamples (k) sim.seqtest.cor(rho.sim = 0.3, k = seq(4, 16, by = 1), rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = 0.05, runs = 10000, plot = TRUE) # Step 2: Determine the optimal nominal type-II-risk based on # the optimal size of subsamples (k) from step 1 sim.seqtest.cor(rho.sim = 0.55, k = 16, rho = 0.3, alternative = "greater", delta = 0.25, alpha = 0.05, beta = seq(0.05, 0.15, by = 0.01), runs = 10000, plot = TRUE) ## End(Not run)
This function performs sample size computation for testing Pearson's correlation coefficient based on precision requirements (i.e., type-I-risk, type-II-risk and an effect size).
size.cor(rho = NULL, delta, alternative = c("two.sided", "less", "greater"), alpha = 0.05, beta = 0.1, output = TRUE)
size.cor(rho = NULL, delta, alternative = c("two.sided", "less", "greater"), alpha = 0.05, beta = 0.1, output = TRUE)
rho |
a number indicating the correlation coefficient under the null hypothesis, |
delta |
minimum difference to be detected, |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
alpha |
type-I-risk, |
beta |
type-II-risk, |
output |
logical: if |
Returns an object of class size
with following entries:
call |
function call |
type |
type of the test (i.e., correlation coefficient) |
spec |
specification of function arguments |
res |
list with the result, i.e., optimal sample size |
Takuya Yanagida [email protected],
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
seqtest.cor
, size.mean
, size.prop
, print.size
#-------------------------------------- # H0: rho = 0.3, H1: rho != 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 size.cor(rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2) #-------------------------------------- # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 size.cor(rho = 0.3, delta = 0.2, alternative = "greater", alpha = 0.05, beta = 0.2)
#-------------------------------------- # H0: rho = 0.3, H1: rho != 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 size.cor(rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2) #-------------------------------------- # H0: rho <= 0.3, H1: rho > 0.3 # alpha = 0.05, beta = 0.2, delta = 0.2 size.cor(rho = 0.3, delta = 0.2, alternative = "greater", alpha = 0.05, beta = 0.2)
This function performs sample size computation for the one-sample and two-sample t-test based on precision requirements (i.e., type-I-risk, type-II-risk and an effect size).
size.mean(theta, sample = c("two.sample", "one.sample"), alternative = c("two.sided", "less", "greater"), alpha = 0.05, beta = 0.1, output = TRUE)
size.mean(theta, sample = c("two.sample", "one.sample"), alternative = c("two.sided", "less", "greater"), alpha = 0.05, beta = 0.1, output = TRUE)
theta |
relative minimum difference to be detected, |
sample |
a character string specifying one- or two-sample t-test, must be one of "two.sample" (default) or "one.sample". |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
alpha |
type-I-risk, |
beta |
type-II-risk, |
output |
logical: if |
Returns an object of class size
with following entries:
call |
function call |
type |
type of the test (i.e., arithmetic mean) |
spec |
specification of function arguments |
res |
list with the result, i.e., optimal sample size |
Takuya Yanagida [email protected],
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
seqtest.mean
, size.prop
, size.cor
, print.size
#-------------------------------------- # Two-sided one-sample test # H0: mu = mu.0, H1: mu != mu.0 # alpha = 0.05, beta = 0.2, theta = 0.5 size.mean(theta = 0.5, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) #-------------------------------------- # One-sided one-sample test # H0: mu <= mu.0, H1: mu > mu.0 # alpha = 0.05, beta = 0.2, theta = 0.5 size.mean(theta = 0.5, sample = "one.sample", alternative = "greater", alpha = 0.05, beta = 0.2) #-------------------------------------- # Two-sided two-sample test # H0: mu.1 = mu.2, H1: mu.1 != mu.2 # alpha = 0.01, beta = 0.1, theta = 1 size.mean(theta = 1, sample = "two.sample", alternative = "two.sided", alpha = 0.01, beta = 0.1) #-------------------------------------- # One-sided two-sample test # H0: mu.1 <= mu.2, H1: mu.1 > mu.2 # alpha = 0.01, beta = 0.1, theta = 1 size.mean(theta = 1, sample = "two.sample", alternative = "greater", alpha = 0.01, beta = 0.1)
#-------------------------------------- # Two-sided one-sample test # H0: mu = mu.0, H1: mu != mu.0 # alpha = 0.05, beta = 0.2, theta = 0.5 size.mean(theta = 0.5, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) #-------------------------------------- # One-sided one-sample test # H0: mu <= mu.0, H1: mu > mu.0 # alpha = 0.05, beta = 0.2, theta = 0.5 size.mean(theta = 0.5, sample = "one.sample", alternative = "greater", alpha = 0.05, beta = 0.2) #-------------------------------------- # Two-sided two-sample test # H0: mu.1 = mu.2, H1: mu.1 != mu.2 # alpha = 0.01, beta = 0.1, theta = 1 size.mean(theta = 1, sample = "two.sample", alternative = "two.sided", alpha = 0.01, beta = 0.1) #-------------------------------------- # One-sided two-sample test # H0: mu.1 <= mu.2, H1: mu.1 > mu.2 # alpha = 0.01, beta = 0.1, theta = 1 size.mean(theta = 1, sample = "two.sample", alternative = "greater", alpha = 0.01, beta = 0.1)
This function performs sample size computation for the one-sample and two-sample test for proportions based on precision requirements (i.e., type-I-risk, type-II-risk and an effect size).
size.prop(pi = NULL, delta, sample = c("two.sample", "one.sample"), alternative = c("two.sided", "less", "greater"), alpha = 0.05, beta = 0.1, correct = FALSE, output = TRUE)
size.prop(pi = NULL, delta, sample = c("two.sample", "one.sample"), alternative = c("two.sided", "less", "greater"), alpha = 0.05, beta = 0.1, correct = FALSE, output = TRUE)
pi |
a number indicating the true value of the probability under the null hypothesis (one-sample test), |
delta |
minimum difference to be detected, |
sample |
a character string specifying one- or two-sample proportion test, must be one of "two.sample" (default) or "one.sample". |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "less" or "greater". |
alpha |
type-I-risk, |
beta |
type-II-risk, |
correct |
a logical indicating whether continuity correction should be applied. |
output |
logical: if |
Returns an object of class size
with following entries:
call |
function call |
type |
type of the test (i.e., proportion) |
spec |
specification of function arguments |
res |
list with the result, i.e., optimal sample size |
Takuya Yanagida [email protected],
Fleiss, J. L., Levin, B., & Paik, M. C. (2003). Statistical methods for rates and proportions (3rd ed.). New York: John Wiley & Sons.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
seqtest.prop
, size.mean
, size.cor
, print.size
#-------------------------------------- # Two-sided one-sample test # H0: pi = 0.5, H1: pi != 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) #-------------------------------------- # One-sided one-sample test # H0: pi <= 0.5, H1: pi > 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "one.sample", alternative = "less", alpha = 0.05, beta = 0.2) #-------------------------------------- # Two-sided two-sample test # H0: pi.1 = pi.2 = 0.5, H1: pi.1 != pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "two.sample", alternative = "two.sided", alpha = 0.01, beta = 0.1) #-------------------------------------- # One-sided two-sample test # H0: pi.1 <= pi.1 = 0.5, H1: pi.1 > pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "two.sample", alternative = "greater", alpha = 0.01, beta = 0.1)
#-------------------------------------- # Two-sided one-sample test # H0: pi = 0.5, H1: pi != 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "one.sample", alternative = "two.sided", alpha = 0.05, beta = 0.2) #-------------------------------------- # One-sided one-sample test # H0: pi <= 0.5, H1: pi > 0.5 # alpha = 0.05, beta = 0.2, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "one.sample", alternative = "less", alpha = 0.05, beta = 0.2) #-------------------------------------- # Two-sided two-sample test # H0: pi.1 = pi.2 = 0.5, H1: pi.1 != pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "two.sample", alternative = "two.sided", alpha = 0.01, beta = 0.1) #-------------------------------------- # One-sided two-sample test # H0: pi.1 <= pi.1 = 0.5, H1: pi.1 > pi.2 # alpha = 0.01, beta = 0.1, delta = 0.2 size.prop(pi = 0.5, delta = 0.2, sample = "two.sample", alternative = "greater", alpha = 0.01, beta = 0.1)
This function updates the seqtest
object
## S3 method for class 'seqtest' update(object, x = NULL, y = NULL, initial = FALSE, output = TRUE, plot = TRUE, ...)
## S3 method for class 'seqtest' update(object, x = NULL, y = NULL, initial = FALSE, output = TRUE, plot = TRUE, ...)
object |
|
x |
data for group 1. |
y |
data for group 2. |
initial |
logical, used internally for creating a |
output |
logical: if |
plot |
logical: if |
... |
further arguments passed to or from other methods. |
Takuya Yanagida [email protected]
Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
Schneider, B., Rasch, D., Kubinger, K. D., & Yanagida, T. (2015).
A Sequential triangular test of a correlation coefficient's null-hypothesis: 0 0.
Statistical Papers, 56, 689-699.
seqtest.mean
, seqtest.prop
, seqtest.cor
,
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(54, 52, 46, 49)) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.56, 0.52))
#-------------------------------------- # Sequential triangular test for the arithmetic mean in one sample seq.obj <- seqtest.mean(56, mu = 50, theta = 0.5, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(54, 52, 46, 49)) #-------------------------------------- # Sequential triangular test for the proportion in one sample seq.obj <- seqtest.prop(c(1, 1, 0, 1), pi = 0.5, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, x = c(1, 1, 1, 1, 1, 0, 1, 1, 1)) #-------------------------------------- # Sequential triangular test for Pearson's correlation coefficient seq.obj <- seqtest.cor(0.46, k = 14, rho = 0.3, delta = 0.2, alpha = 0.05, beta = 0.2, plot = TRUE) seq.obj <- update(seq.obj, c(0.56, 0.76, 0.56, 0.52))