Description Usage Arguments Details Value Note Author(s) References Examples
Estimate the sample size that would be required to detect a specified difference in a one factor study. The estimate is based on the variability that was observed in a previous one factor study. A cgOneFactorSampleSizeTable class object is created.
1 2 3  ## S4 method for signature 'cgOneFactorFit'
samplesizeTable(fit, direction, mmdvec,
power = 0.80, alpha = 0.05, nmax = 1000, display = "print", ...)

fit 
A 
direction 
A 
mmdvec 
A 
power 
The power for the future study, set by default to be 
alpha 
The significance level or alpha for the future study, set by default
as 
nmax 
The maximum number of subjects per group. If more subjects are estimated to be required, then the exact number required is not reported, only the fact that more than the maximum number would be required. This is in place to prevent long and likely unnecessary calculations. 
display 
One of three valid values:

... 
Additional arguments.

This sample size method does not work for fitted models that allowed unequal variances or censored observations.
Sample sizes are estimated for detecting a minimum difference with a global
F test. The algorithm is detailed in Fleiss (1986), Appendix A. When
there are more than 2 groups, the lower bound of possible
noncentrality parameter values is calculated from assuming only two of
the ngrps
number of groups differ by the mmdvec/2
amount
from the "grand mean" while the rest of the groups are equal to the grand
mean.
For detecting an absolute difference, the sample size is the
smallest group size n for which
1  pf (qf (1  alpha, numdf, dendf), numdf,
dendf, ncp)
exceeds power
,
where ncp = (n * mmdvec ^ 2) / (2 *
sigamest ^ 2)
, and sigmaest
is the residual mean square error from the model in
fit
. For detecting a relative difference, the calculations are
the same except
ncp = (n * (log (sign * mmdvec / 100 + 1) ) ^ 2) / (2
* sigmaest ^ 2)
, where
sign = 1
if direction="decreasing"
,
and sign = 1
if direction = "increasing"
.
Creates an object of class cgOneFactorSampleSizeTable
, with the
following slots:
ols.sstable
A matrix with the estimated sample sizes based on the
classical model variance estimates, or NULL
. The matrix has 3 columns and
one row for each element of the mmdvec
vector
.
The first column specifies the minimum meaningful difference ("mmd"
).
The second column gives the number of subjects required for each
group ("n"
), possibly truncated at nmax
.
The third column gives the total number of
subjects required ("N"
), also truncated if
nmax
is truncated.
rr.sstable
A matrix with the estimated sample sizes based on the
robust model variance estimates, or else NULL
if
model="olsonly"
was specified. See the ols.sstable
slot description above for the analogous layout of the matrix.
settings
A list of properties mostly carried asis from the
data
argument object of class
cgOneFactorData
, with the following additional members:
sigmaest
A list with 2 members, ols
, containing the
estimated spread (sigma, standard deviation) from
the classical model of fit
,
and rr
,
containing the estimated spread (sigma, standard deviation)
from the robust model of
fit
, or
NULL
if the robust model was not fit.
planningname
A character
describing the study
or purpose of the sample size analysis. Taken from the
settings$analysisname
of the fit
object.
ngrps
A saved copy of the ngrps
argument.
direction
A saved copy of the direction
argument.
alpha
A saved copy of the alpha
argument.
power
A saved copy of the power
argument.
nmax
A saved copy of the nmax
argument.
Contact cg@billpikounis.net for bug reports, questions, concerns, and comments.
Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]
Fleiss, J.L. (1986). The Design and Analysis of Clinical Experiments, Appendix A, pages 371  376. New York: Wiley.
1 2 3 4 5 6 7 8 9 10 11 12 13  data(canine)
canine.data < prepareCGOneFactorData(canine, format="groupcolumns",
analysisname="Canine",
endptname="Prostate Volume",
endptunits=expression(plain(cm)^3),
digits=1, logscale=TRUE, refgrp="CC")
canine.fit < fit(canine.data)
canine.samplesize < samplesizeTable(canine.fit, direction="increasing",
mmdvec=c(10, 25, 50, 75, 100))
samplesizeTable(canine.fit, direction="decreasing",
mmdvec=c(25, 50, 75), model="olsonly")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.