Learn R Programming

cg (version 1.0-3)

samplesizeTable: Estimate Required Sample Sizes

Description

Estimate the sample size required to detect a specified difference in a future study. The estimate is based on the variability in a data fit with the cg package.

Usage

samplesizeTable(fit, direction, mmdvec, power = 0.80, alpha = 0.05, nmax = 1000, display = "print", ...)

Arguments

fit
An object created by calling a fit method from the cg package. There is currently one class of objects that are currently available: cgOneFactorFit, which is prepared by the fit.cgOneFactorData method.
direction
A character 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.
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 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.
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 truly exist.
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 and likely unnecessary calculations.
display
One of three valid values:
"print"
The default value; It calls a print method for the created samplesizeTable object, which is a formatted text output of the table(s).

"none"
Supresses any printing. Useful, for example, when just assignment of the resulting object is desired.

"show"
Calls the default showDefault method, which will just print out the samplesizeTable components.

...
Additional arguments, depending on the specific method written for the object. See the method-specific documentation for additional details.

Value

A method-specific SampleSizeTable object is returned. See the specific methods for discussion of return values.

See Also

samplesizeTable.cgOneFactorFit

Examples

Run this code
#### One Factor data

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))

samplesizeGraph(canine.samplesize)


Run the code above in your browser using DataLab