samplesizeTable.cgOneFactorFit {cg} | R Documentation |
Estimate Sample Sizes based on a cgOneFactorFit object
Description
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.
Usage
## S4 method for signature 'cgOneFactorFit'
samplesizeTable(fit, direction, mmdvec,
power = 0.80, alpha = 0.05, nmax = 1000, display = "print", ...)
Arguments
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.
|
Details
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"
.
Value
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 themmdvec
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 atnmax
. The third column gives the total number of subjects required ("N"
), also truncated ifnmax
is truncated.rr.sstable
A matrix with the estimated sample sizes based on the robust model variance estimates, or else
NULL
ifmodel="olsonly"
was specified. See theols.sstable
slot description above for the analogous layout of the matrix.settings
A list of properties mostly carried as-is from the
data
argument object of classcgOneFactorData
, with the following additional members:sigmaest
A list with 2 members,
ols
, containing the estimated spread (sigma, standard deviation) from the classical model offit
, andrr
, containing the estimated spread (sigma, standard deviation) from the robust model offit
, orNULL
if the robust model was not fit.planningname
A
character
describing the study or purpose of the sample size analysis. Taken from thesettings$analysisname
of thefit
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.
Note
Contact cg@billpikounis.net for bug reports, questions, concerns, and comments.
Author(s)
Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]
References
Fleiss, J.L. (1986). The Design and Analysis of Clinical Experiments, Appendix A, pages 371 - 376. New York: Wiley.
Examples
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")