samplesizeTable.cgPairedDifferenceFit {cg} | R Documentation |
Estimate Sample Sizes based on a cgPairedDifferenceFit object
Description
Estimate the sample size that would be required to detect a specified difference in a paired difference data study. The estimate is based on the variability that was observed in a previous paired difference data study. A cgPairedDifferenceSampleSizeTable class object is created.
Usage
## S4 method for signature 'cgPairedDifferenceFit'
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, than 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. Only one is currently valid:
|
Details
Here, the estimated sample size actually refers to the number of experimental units. Hence the number of observations will always be twice the number of experimental units, due to the paired structure.
This sample size method only works for the classical least squares fitted model, since there is no analogous decomposition of total variance into between-experimental unit and within-experimental unit variance components. Sample sizes are estimated for detecting a minimum difference with the classical least squares t-test / F-test.
The correction = "df"
argument specifies a method that Fleiss
(1986, pages 129-130) attributes to Cochran and Cox (1957) and Fisher.
The correction decreases the relative efficiency that is calculated
from accounting for correlated paired observations, relative to the unpaired two group
design. The adjustment accounts for the different degrees of freedom
used for the variance components in the paired design
(between-experimental unit, within-experimettal unit, total variability.)
Since the correction reduces the relative efficiency, and the
noncentrality parameter is also reduced. The correction
is a multiplicative factor bounded below
by 0.833 and approaches 1 as the number of experimental units
increments from the minimum of n=2
. The reduction in the
noncentrality parameter increases the computed sample size.
Value
Creates an object of class cgPairedDifferenceSampleSizeTable
, with the
following slots:
ols.sstable
A matrix with the estimated experimental unit sample sizes based on the classical model variance estimates. 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 experimental units ("n"
) required, possibly truncated atnmax
. The third column gives the total number of observations ("N"
), also possibly truncated atnmax
. Since this for the paired groups design,N = n * 2
will always hold.settings
A list of properties mostly carried as-is from the
data
argument object of classcgPairedDifferenceData
, with the following additional members:sigmaest
A list with 1 member,
ols
, containing the estimated spread (sigma, standard deviation) variance estimates from the classical model offit
. This list component is a vector of length 3, providing the within-experimental unit, between experimental unit, and total variability estimates.planningname
A
character
describing the study or purpose of the sample size analysis. Taken from thesettings$analysisname
of thefit
object.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, John Oleynick, and Eva Ye
References
Fleiss, J. L. (1986). The Design and Analysis of Clinical Experiments, pages 129 - 130. New York: Wiley.
Cochran, W. G. and Cox, G. M. (1957), Experimental Designs. Second edition. Wiley.
Examples
data(anorexiaFT)
anorexiaFT.data <- prepareCGPairedDifferenceData(anorexiaFT, format="groupcolumns",
analysisname="Anorexia FT",
endptname="Weight",
endptunits="lbs",
expunitname="Patient",
digits=1,
logscale=TRUE)
anorexiaFT.fit <- fit(anorexiaFT.data)
## Recall the interest is in increased weight for the anorexia FT
## (family treatment) group of patients
samplesizeTable(anorexiaFT.fit, direction="increasing",
mmdvec=c(5, 10, 15, 20))
## and with the adjustment on the noncentrality parameter
samplesizeTable(anorexiaFT.fit, direction="increasing",
mmdvec=c(5, 10, 15, 20), correction="df")