Learn R Programming

cg (version 1.0-2)

samplesizeTable.cgPairedDifferenceFit: 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

## S3 method for class 'cgPairedDifferenceFit':
samplesizeTable(fit, direction, mmdvec,
 power = 0.80, alpha = 0.05, nmax = 1000, display = "print", \dots)

Arguments

fit
A cgPairedDifferenceFit object from a previous paired difference data study.
direction
A 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
mmdvec
A 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 ar
power
The power for the future study, set by default to be 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 a difference
alpha
The significance level or alpha for the future study, set by default as 0.05.
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 an
display
One of three valid values: [object Object],[object Object],[object Object]
...
Additional arguments. Only one is currently valid: [object Object]

Value

  • Creates an object of class cgPairedDifferenceSampleSizeTable, with the following slots: [object Object],[object Object]

concept

sample size

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.

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

Run this code
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")

Run the code above in your browser using DataLab