Learn R Programming

cg (version 0.9-2)

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

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

Arguments

fit
A cgOneFactorFit object from a previous one factor study.
ngrps
The number of groups that will be in the future one factor 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 differences
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 cgOneFactorSampleSizeTable, with the following slots: [object Object],[object Object],[object Object]

concept

sample size

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".

References

Fleiss, J.L. (1986). The Design and Analysis of Clinical Experiments, Appendix A, pages 371 - 376. New York: Wiley.

Examples

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