Title: | Efficient Determination of Sample Size in Balanced Design of Experiments |
---|---|
Description: | For a balanced design of experiments, this package calculates the sample size required to detect a certain standardized effect size, under a significance level. This package also provides three graphs; detectable standardized effect size vs power, sample size vs detectable standardized effect size, and sample size vs power, which show the mutual relationship between the sample size, power and the detectable standardized effect size. The detailed procedure is described in R. V. Lenth (2006-9) <https://homepage.divms.uiowa.edu/~rlenth/Power/>, Y. B. Lim (1998), M. A. Kastenbaum, D. G. Hoel and K. O. Bowman (1970) <doi:10.2307/2334851>, and Douglas C. Montgomery (2013, ISBN: 0849323312). |
Authors: | Jong Hee Chung [aut, cre], Yong Bin Lim [aut], Donghoh Kim [ctb] |
Maintainer: | Jong Hee Chung <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.6 |
Built: | 2024-10-31 06:26:47 UTC |
Source: | CRAN |
This function produces graphs between the sample size, power and the detectable standardized effect size of two-level fractional factorial design.
plots.2levFr(nfactor, nfraction, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
plots.2levFr(nfactor, nfraction, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
nfactor |
the number of factor. |
nfraction |
the number of fraction. For example, when a model is |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
deltao |
the minimal detectable standardized effect size for power vs the sample size plot when |
alpha |
Type I error. |
beta |
Type II error. |
type |
graph type: 1 for Power vs Delta plot, 2 for Delta vs Sample size plot, and 3 for Power vs Sample size plot. |
maxsize |
tolerance for sample size. |
This function produces graph between the sample size, power 1-beta
and the detectable standardized effect size delta
of two-level fractional factorial design.
According to type
, it displays plot of Power vs Delta, Delta vs Sample size, or Power vs Sample size.
plot of Power vs Delta, Delta vs Sample size, or Power vs Sample size according to type
.
plots.Full
, plots.Split
, plots.Block
.
# plot of Power vs Delta for two-level fractional factorial design # without the interaction effects plots.2levFr(nfactor=3, nfraction=1, interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Sample size for two-level fractional factorial design # with the interaction effects plots.2levFr(nfactor=5, nfraction=1, interaction=TRUE, delta_type=1, delta=c(1, 1, 1), deltao=1, alpha=0.05, beta=0.2, type=3)
# plot of Power vs Delta for two-level fractional factorial design # without the interaction effects plots.2levFr(nfactor=3, nfraction=1, interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Sample size for two-level fractional factorial design # with the interaction effects plots.2levFr(nfactor=5, nfraction=1, interaction=TRUE, delta_type=1, delta=c(1, 1, 1), deltao=1, alpha=0.05, beta=0.2, type=3)
This function produces graphs between the sample size, power and the detectable standardized effect size of randomized complete block design.
plots.Block(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
plots.Block(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
factor.lev |
vector of the numbers of levels for each factor. |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
deltao |
the minimal detectable standardized effect size for power vs the number of blocks plot when |
alpha |
Type I error. |
beta |
Type II error. |
type |
graph type: 1 for Power vs Delta plot, 2 for Delta vs the Number of Blocks plot, and 3 for Power vs the Number of Blocks plot. |
maxsize |
tolerance for the number of blocks. |
In a randomized complete block design (without replications), the optimal number of blocks need to be determined.
This function produces graph between Number of Block, power 1-beta
and the detectable standardized effect size delta
of randomized complete block design.
According to type
, it displays plot of Power vs Delta, Delta vs Number of Blocks, or Power vs Number of Blocks.
plot of Power vs Delta, Delta vs Number of Blocks, or Power vs Number of Blocks according to type
.
plots.Full
, plots.2levFr
, plots.Split
.
# plot of Power vs Delta for randomized complete block design # with 2 factors without the interaction effects plots.Block(factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Number of Blocks for randomized complete block design # with 2 factors with the interaction effects plots.Block(factor.lev=c(2, 3), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), deltao=1.5, alpha=0.05, beta=0.2, type=3)
# plot of Power vs Delta for randomized complete block design # with 2 factors without the interaction effects plots.Block(factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Number of Blocks for randomized complete block design # with 2 factors with the interaction effects plots.Block(factor.lev=c(2, 3), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), deltao=1.5, alpha=0.05, beta=0.2, type=3)
This function produces graphs between the sample size, power and the detectable standardized effect size of full factorial design.
plots.Full(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
plots.Full(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
factor.lev |
vector of the numbers of levels for each factor. |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
deltao |
the minimal detectable standardized effect size for power vs the sample size plot when |
alpha |
Type I error. |
beta |
Type II error. |
type |
graph type: 1 for Power vs Delta plot, 2 for Delta vs Sample size plot, and 3 for Power vs Sample size plot. |
maxsize |
tolerance for sample size. |
This function produces graph between the sample size, power 1-beta
and the detectable standardized effect size delta
of full factorial design.
According to type
, it displays plot of Power vs Delta, Delta vs Sample size, or Power vs Sample size.
plot of Power vs Delta, Delta vs Sample size, or Power vs Sample size according to type
.
plots.2levFr
, plots.Split
, plots.Block
.
# plot of Power vs Delta for full factorial design # with 2 factors without the interaction effects plots.Full(factor.lev=c(2, 3), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Sample size for full factorial design # with 2 factors with the interaction effects plots.Full(factor.lev=c(2, 3), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), deltao=1.5, alpha=0.05, beta=0.2, type=3)
# plot of Power vs Delta for full factorial design # with 2 factors without the interaction effects plots.Full(factor.lev=c(2, 3), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Sample size for full factorial design # with 2 factors with the interaction effects plots.Full(factor.lev=c(2, 3), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), deltao=1.5, alpha=0.05, beta=0.2, type=3)
This function produces graphs between the sample size, power and the detectable standardized effect size of split-plot design.
plots.Split(whole.factor.lev, split.factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
plots.Split(whole.factor.lev, split.factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1, 1), deltao = NULL, alpha = 0.05, beta = 0.2, type = 1, maxsize = 1000)
whole.factor.lev |
vector of the numbers of levels for each whole factor. |
split.factor.lev |
vector of the numbers of levels for each split factor. |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
deltao |
the minimal detectable standardized effect size for power vs the sample size plot when |
alpha |
Type I error. |
beta |
Type II error. |
type |
graph type: 1 for Power vs Delta plot, 2 for Delta vs Sample size plot, and 3 for Power vs Sample size plot. |
maxsize |
tolerance for sample size. |
This function produces graph between the sample size, power 1-beta
and the detectable standardized effect size delta
of split-plot design.
According to type
, it displays plot of Power vs Delta, Delta vs Sample size, or Power vs Sample size.
The number of whole-plot factors and split plot factors are up to 2 in the current package version.
plot of Power vs Delta, Delta vs Sample size, or Power vs Sample size according to type
.
plots.Full
, plots.2levFr
, plots.Block
.
# plot of Power vs Delta for split-plot design # without the interaction effects plots.Split(whole.factor.lev=2, split.factor.lev=2, interaction=FALSE, delta_type=1, delta=c(1, 0, 1, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Sample size for split-plot design # with the interaction effects plots.Split(whole.factor.lev=2, split.factor.lev=2, interaction=TRUE, delta_type=1, delta=c(1, 1, 1, 1), deltao=1, alpha=0.05, beta=0.2, type=3)
# plot of Power vs Delta for split-plot design # without the interaction effects plots.Split(whole.factor.lev=2, split.factor.lev=2, interaction=FALSE, delta_type=1, delta=c(1, 0, 1, 1), alpha=0.05, beta=0.2, type=1) # plot of Power vs Sample size for split-plot design # with the interaction effects plots.Split(whole.factor.lev=2, split.factor.lev=2, interaction=TRUE, delta_type=1, delta=c(1, 1, 1, 1), deltao=1, alpha=0.05, beta=0.2, type=3)
This function computes sample size for two-level fractional factorial design to detect a certain standardized effect size with power at the significance level. The model for fractional factorial design contains only main effects in resolution III and IV.
Size.2levFr(nfactor, nfraction, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
Size.2levFr(nfactor, nfraction, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
nfactor |
the number of factor. |
nfraction |
the number of fraction. For example, when a model is |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
alpha |
Type I error. |
beta |
Type II error. |
maxsize |
tolerance for sample size. |
This function computes sample size in two-level fractional factorial design to detect a certain standardized effect size delta
with power 1-beta
at the significance level alpha
.
model |
a character vector expressing a model. The main effects are expressed by the upper-case letters of the Roman alphabet, and two-way interaction effects are denoted by * operator for pairs of the main effects. |
n |
optimal sample size. |
Delta |
a vector of minimal detectable standardized effect sizes. |
R. V. Lenth (2006-9). Java Applets for Power and Sample Size[Computer software]. Retrieved March 27, 2018 from https://homepage.divms.uiowa.edu/~rlenth/Power/.
Y. B. Lim (1998). Study on the Size of Minimal Standardized Detectable Difference in Balanced Design of Experiments. Journal of the Korean society for Quality Management, 26(4), 239–249.
M. A. Kastenbaum, D. G. Hoel and K. O. Bowman (1970) Sample size requirements : one-way analysis of variance, Biometrika, 57(2), 421–430.
D. C. Montgomery (2013) Design and analysis of experiments. John Wiley & Sons.
Size.Full
, Size.Split
, Size.Block
.
# only main effects model1 <- Size.2levFr(nfactor=3, nfraction=1, interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2) model1$model model1$n model1$Delta # including two-way interaction effects model2 <- Size.2levFr(nfactor=5, nfraction=1, interaction=TRUE, delta_type=1, delta=c(1, 1, 1), alpha=0.05, beta=0.2)
# only main effects model1 <- Size.2levFr(nfactor=3, nfraction=1, interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2) model1$model model1$n model1$Delta # including two-way interaction effects model2 <- Size.2levFr(nfactor=5, nfraction=1, interaction=TRUE, delta_type=1, delta=c(1, 1, 1), alpha=0.05, beta=0.2)
This function computes the number of blocks for randomized complete block design to detect a certain standardized effect size with power at the significance level.
Size.Block(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
Size.Block(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
factor.lev |
vector of the numbers of levels for each factor. |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
alpha |
Type I error. |
beta |
Type II error. |
maxsize |
tolerance for the number of blocks. |
In a randomized complete block design (without replications), the optimal number of blocks need to be determined.
This function computes the number of blocks for randomized complete block design to detect a certain standardized effect size delta
with power 1-beta
at the significance level alpha
.
model |
a character vector expressing a model. The main effects are expressed by the upper-case letters
of the Roman alphabet, and two-way interaction effects are denoted by * operator for pairs of the main effects.
The block factor is denoted by |
n |
optimal the number of blocks. |
Delta |
a vector of minimal detectable standardized effect sizes. |
R. V. Lenth (2006-9). Java Applets for Power and Sample Size[Computer software]. Retrieved March 27, 2018 from https://homepage.divms.uiowa.edu/~rlenth/Power/.
Y. B. Lim (1998). Study on the Size of Minimal Standardized Detectable Difference in Balanced Design of Experiments. Journal of the Korean society for Quality Management, 26(4), 239–249.
M. A. Kastenbaum, D. G. Hoel and K. O. Bowman (1970) Sample size requirements : one-way analysis of variance, Biometrika, 57(2), 421–430.
D. C. Montgomery (2013) Design and analysis of experiments. John Wiley & Sons.
Size.Full
, Size.2levFr
, Size.Split
.
# only main effects model1 <- Size.Block(factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2) model1$model model1$n model1$Delta # including two-way interaction effects model2 <- Size.Block(factor.lev=c(2, 2), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), alpha=0.05, beta=0.2) model2
# only main effects model1 <- Size.Block(factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2) model1$model model1$n model1$Delta # including two-way interaction effects model2 <- Size.Block(factor.lev=c(2, 2), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), alpha=0.05, beta=0.2) model2
This function computes sample size for full factorial design to detect a certain standardized effect size with power at the significance level.
Size.Full(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
Size.Full(factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
factor.lev |
vector of the numbers of levels for each factor. |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
alpha |
Type I error. |
beta |
Type II error. |
maxsize |
tolerance for sample size. |
This function computes sample size in full factorial design to detect a certain standardized effect size delta
with power 1-beta
at the significance level alpha
.
model |
a character vector expressing a model. The main effects are expressed by the upper-case letters of the Roman alphabet, and two-way interaction effects are denoted by * operator for pairs of the main effects. |
n |
optimal sample size. |
Delta |
a vector of minimal detectable standardized effect sizes. |
R. V. Lenth (2006-9). Java Applets for Power and Sample Size[Computer software]. Retrieved March 27, 2018 from https://homepage.divms.uiowa.edu/~rlenth/Power/.
Y. B. Lim (1998). Study on the Size of Minimal Standardized Detectable Difference in Balanced Design of Experiments. Journal of the Korean society for Quality Management, 26(4), 239–249.
M. A. Kastenbaum, D. G. Hoel and K. O. Bowman (1970) Sample size requirements : one-way analysis of variance, Biometrika, 57(2), 421–430.
D. C. Montgomery (2013) Design and analysis of experiments. John Wiley & Sons.
Size.2levFr
, Size.Split
, Size.Block
.
# only main effects model1 <- Size.Full(factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2) model1$model model1$n model1$Delta # including two-way interaction effects model2 <- Size.Full(factor.lev=c(2, 2), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), alpha=0.05, beta=0.2) model2
# only main effects model1 <- Size.Full(factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1), alpha=0.05, beta=0.2) model1$model model1$n model1$Delta # including two-way interaction effects model2 <- Size.Full(factor.lev=c(2, 2), interaction=TRUE, delta_type=1, delta=c(1, 1, 1), alpha=0.05, beta=0.2) model2
This function computes sample size for split-plot design to detect a certain standardized effect size with power at the significance level.
Size.Split(whole.factor.lev, split.factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
Size.Split(whole.factor.lev, split.factor.lev, interaction = FALSE, delta_type = 1, delta = c(1, 0, 1, 1), alpha = 0.05, beta = 0.2, maxsize = 1000)
whole.factor.lev |
vector of the numbers of levels for each whole factor. |
split.factor.lev |
vector of the numbers of levels for each split factor. |
interaction |
specifies whether two-way interaction effects are included in a model with the main effects. When |
delta_type |
specifies the type of standardized effect size: 1 for standard deviation type and 2 for range type. |
delta |
vector of effect sizes: |
alpha |
Type I error. |
beta |
Type II error. |
maxsize |
tolerance for sample size. |
This function computes sample size in split-plot design to detect a certain standardized effect size delta
with power 1-beta
at the significance level alpha
.
The number of whole-plot factors and split plot factors are up to 2 in the current package version.
The linear model for the split-plot design is
where is the replicate effect,
is the whole-plot main effects,
is the whole-plot error,
is the subplot main effects, and
is the subplot error.
model |
a character vector expressing a model. The whole factor effects and the split factor effects are expressed by the lower-case letters and sequential upper-case letters of the Roman alphabet, and two-way interaction effects are denoted by * operator for pairs of the those effects. |
n |
optimal sample size. |
Delta |
a vector of minimal detectable standardized effect sizes. |
R. V. Lenth (2006-9). Java Applets for Power and Sample Size[Computer software]. Retrieved March 27, 2018 from https://homepage.divms.uiowa.edu/~rlenth/Power/.
Y. B. Lim (1998). Study on the Size of Minimal Standardized Detectable Difference in Balanced Design of Experiments. Journal of the Korean society for Quality Management, 26(4), 239–249.
M. A. Kastenbaum, D. G. Hoel and K. O. Bowman (1970) Sample size requirements : one-way analysis of variance, Biometrika, 57(2), 421–430.
D. C. Montgomery (2013) Design and analysis of experiments. John Wiley & Sons.
Size.Full
, Size.2levFr
, Size.Block
.
# only main effects splitmodel1 <- Size.Split(whole.factor.lev=c(2, 2), split.factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1, 1), alpha=0.05, beta=0.2) splitmodel1$model splitmodel1$n splitmodel1$Delta # including two-way interaction effects splitmodel2 <- Size.Split(whole.factor.lev=c(2, 2), split.factor.lev=c(2, 2), interaction=TRUE, delta_type=1, delta=c(1, 1, 1, 1), alpha=0.05, beta=0.2) splitmodel2
# only main effects splitmodel1 <- Size.Split(whole.factor.lev=c(2, 2), split.factor.lev=c(2, 2), interaction=FALSE, delta_type=1, delta=c(1, 0, 1, 1), alpha=0.05, beta=0.2) splitmodel1$model splitmodel1$n splitmodel1$Delta # including two-way interaction effects splitmodel2 <- Size.Split(whole.factor.lev=c(2, 2), split.factor.lev=c(2, 2), interaction=TRUE, delta_type=1, delta=c(1, 1, 1, 1), alpha=0.05, beta=0.2) splitmodel2