"samplesizeTable"(fit, direction, mmdvec, power = 0.80, alpha = 0.05, nmax = 1000, display = "print", ...)
cgOneFactorFit
object from a previous one factor study.
character
value indicating whether the sample size should be estimated
to detect an "increase"
or a "decrease"
. This only effects
the sample size estimates if the previous study in fit
was
analyzed on the log scale, in which case the differences in mmdvec
are relative differences instead of absolute differences.
For detecting relative changes, the sample size
required to detect a relative increase of 25% is not the same as the sample
size to detect a relative decrease of 25%, for example. But for detecting
absolute changes, the sample size required
to detect an absolute increase of 25 is the same as the sample size
to detect an absolute decrease of 25.
numeric
vector
specifying the minimum meaningful differences
to be detected in the future study. If the previous study
in fit
was analyzed on the log scale, then the values in mmdvec
are assumed to be relative percentage increases or decreases, depending
on the value of direction
. If the previous study in
fit
was not analyzed on the log scale, then the values in mmdvec
are assumed to be absolute increases or decreases, depending on
the value of direction
. Each value in mmdvec
needs to
be positive.
0.80
.
This is equivalent
to $1 - \beta$, where $\beta$ is the probability of
committing a Type II error: accepting the null hypothesis of
no difference when differences truly exist.
0.05
.
"print"
print
method for the
created cgOneFactorSamplesizeTable
object, which is
a formatted text output of the table(s).
"none"
"show"
showDefault
method, which
will just print out the cgOneFactorSamplesizeTable
components.
ngrps
ngrps = 2
.
model
character
value indicating which variability estimate
in
fit
should be
used to estimate the sample size: the robust model ("rronly"
),
the classical model ("olsonly"
), or both ("both"
). If an estimate
is requested for a model that was not fit, then no sample sizes are returned
for that model but an error is not reported (e.g. if only the classical model
was fitted but "both" are requested, only the classical model estimates
will be returned):
"both"
cgOneFactorFit
object specified in the fit
argument. If the resistant & robust fit is not available,
this value is not relevant.
"olsonly"
olsfit
fit is calculated.
"rronly"
rrfit
fit is calculated.
cgOneFactorSampleSizeTable
, with the
following slots:ols.sstable
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
NULL
if
model="olsonly"
was specified. See the ols.sstable
slot description above for the analogous layout of the matrix.
settings
data
argument object of class
cgOneFactorData
, with the following additional members:
sigmaest
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
character
describing the study
or purpose of the sample size analysis. Taken from the
settings$analysisname
of the fit
object. ngrps
ngrps
argument. direction
direction
argument. alpha
alpha
argument. power
power
argument. nmax
nmax
argument. 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"
.
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")
Run the code above in your browser using DataLab